int, boolean, float etc. are not _primitive_ data types in python. If you say that, you really have no idea, what you are talking about. They are objects like everything else. You can inherit from them and do all the good OO stuff. Sorry for the nitpicking, but calling them primitive types, is just plain wrong.
Author here. Sorry for that. I know they are objects but if you consider everything an object then really you have no primitives except object itself. Certainly this has a place in programming philosophy but not really a helpful point in a language-primer/cheat sheet.
Learn Python in minutes
41–50 of 59 posts
Re: Learn Python in minutes
#42Re: Learn Python in minutes
#43for you gurus, it's got a cool new feature: debugging Python & C++ together: http://www.youtube.com/watch?v=wvJaKQ94lBY
Re: Learn Python in minutes
#44Re: Learn Python in minutes
#45 [1, 2]
but is instead (1, 2)
The second line of that output also happens to be wrong, because printing a dictionary uses repr() on its keys and values and str.__repr__ normally uses single quotes, so instead of {"a": 3, "b": 4}
It will instead print {'a': 3, 'b': 4}
For that matter, I would prefer it if this guide used single quotes primarily; that is the preferred standard in Python.Re: Learn Python in minutes
#46Kudos to whomever wrote it.
Re: Learn Python in minutes
#47Re: Learn Python in minutes
#48Nice and concise. It would be complemented nicely by a list of Python "gotchas". E.g., off the top of my head, mutable default arguments, or trying to catch multiple exceptions with "except Exception1, Exception2:". That's the kind of thing people new to the language can spend a lot of time debugging when they first run into it. Edit: and any introduction to tuples should probably show how to write empty and one-elem…
Author here. I didn't want to overload the reader. Perhaps a more in-depth guide is required.
Re: Learn Python in minutes
#49"Learn X in 30 Days" has gone to "Learn X in Minutes" I am waiting for "Learn X While You Sleep--wake up as an expert!"
I used to sleep with a walkman plugged in and playing german vocab - everyone knew that was guaranteed to work
If Michael Jackson just knew that......