6 ms·
I realize that the author is probably joking in saying they "learned enough to be dangerous", but I think it's worth pointing out that you can't really learn en
by j_baker 15y ago
I realize that the author is probably joking in saying they "learned enough to be dangerous", but I think it's worth pointing out that you can't really learn enough Python to be dangerous. That's one of the nice things about it. If you screw something up, it will let you know (albeit not necessarily as soon as a more strongly typed language would).
My advice: stop worrying about being "dangerous", and be bold! Experiment with any wild ideas you have and see if you can figure out a way to implement them in the language as well as (or perhaps even especially) the libraries that are included with the language. When you bring on a "real" programmer, they may want to kill you, but that's how you learn. Plus, if you're really that bad, you probably won't have written enough code to make that programmer's life miserable for long.
- tswicegood 15y agoAs long as you can `import os`, you can be dangerous in Python. :-)
- j_baker 15y agoI would be curious to see an example of such dangers. It would certainly take a lot of effort to do something stupid in such a way that your program won't necessarily crash with an exception (I'm thinking things like segfaults, heap corruption, etc). I don't doubt such a thing exists, nor do I doubt there's an idiot out there who can exploit it, but I think the vast majority of newbies out there are going to be more fascinated by other parts of the standard library. Did you know you can make HTTP requests using urllib2? Or that you can open a web browser using webbrowser? Or have you seen Django's automatic admin interface? How cool is that?!
- frankwiles 15y agoI know Travis and yes he knows those things. What he means by "being dangerous" are things like os.remove(), os.removedirs(), os.chmod(), etc. He wasn't talking about crashing your own Python code, but being able to do dangerous things to the OS you're running it on.
- Ixiaus 15y agoWhy is that anymore dangerous than knowing how rm, rmdir, and chmod work on the commandline? Python's os module is not exempt from permissions - it's obviously "dangerous" if you run the interpeter as root then start doing silly things like passing GET parameters to os.remove() directly... But that, IMHO, is no longer dangerous - that's just stupidity. Really, there's nothing remotely dangerous about Python - in terms of using import os (excluding the above example which I consider idiocy), it's no more dangerous than elevating to root!? [EDIT] I would argue that not knowing how something works is more dangerous, but that typically falls under the banner of ignorance.
- jerf 15y ago"Why is that anymore dangerous than knowing how rm, rmdir, and chmod work on the commandline?" To screw up is human. To screw up a million times per second takes a computer. In absolute terms, the two are equivalent. But the capacity for your Python program using os.whatever to unpleasantly surprise you is much greater.
- trafficlight 15y agoThere's nothing like that sinking feeling you get when you do a DELETE FROM and forget the WHERE.
- weaksauce 15y agoThat's exactly why begin transaction is awesome.
- pbhjpbhj 15y agoNone of that is _dangerous_ though because you've got a backup of all your data and your code is all versioned ... unless you're practicing your python on life-support systems or something?
- tswicegood 15y agoFrank's response covers it for me. There's plenty of dangerous things you can do in os. Same goes for sys, etc. None of them are going to launch missiles at someone or cause elevators to stop working, but you could blow away a day's work, drop a directory by accident, or some such.
- eddy_chan 15y agoIt's tongue in cheek from having to do a lot of copy writing at my last job. :) that being said I'm implementing a multiple-tenant app where I will have multiple user 'sites' or 'accounts' in my single django app. I've installed things like django-paypal and django-registration and had to modify them to suit my needs. I just love how there's so many pre-written modules out there on github. At first I was really scared about modifying other people's code but as I read it through again and again it started making sense and I realized what I needed to change to make it hook into mine.
- beatpanda 15y agoI learned Python and Django and don't feel dangerous enough yet. How much C does it take to cause serious trouble?
- wollw 15y agoKnowing how to loop over an array is enough to cause a buffer overflow if you aren't careful. edit: Or just using the standard "gets" function really. There's an example on StackOverflow here: http://stackoverflow.com/questions/3026361/performing-simple-buffer-overflow-on-mac-os-10-6 http://stackoverflow.com/questions/3026361/performing-simple...