Live data from Hacker News

Learn Python in minutes

learnxinyminutes.com

41–50 of 59 posts

Re: Learn Python in minutes

#41
post #33
post #18

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.

I agree that "everything is an object" doesn't mean much but "primitive types" has a strong meaning when it comes to OO programming so a different term might be more appropriate.

Re: Learn Python in minutes

#45
An error: *args arrive as a tuple, not a list, so the first line that all_the_args(1, 2, a=3, b=4) prints is not:

    [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

#46
I don't know the efficacy of this as an educational tool, but as a Python programmer, it's a really handy "cheat sheet" to have around whenever doing general scripting. It's really well written as well.

Kudos to whomever wrote it.

Re: Learn Python in minutes

#48
post #31
post #11

Nice 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.

Hey, thanks for the guide. It's a concise read :) looking forward to the article on Python 3.

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

I put my computer on youtube's google io talk whenever I can't get to sleep. It sures put me to sleep fast. :-)

If Michael Jackson just knew that......

Post reply on HN