Cheat sheet
I wrote a little cheat sheet for this wonderful language, but because of my still little experience with it, I would like to have a feedback Could you have a look at it and tell me what do you think about, please? http://greyfox.imente.org/index.php?id=73 -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Markus Gritsch ha scritto: > On Dec 27, 11:38 am, "Riccardo T." <[EMAIL PROTECTED]> wrote: >> I wrote a little cheat sheet for this wonderful language, but because of >> my still little experience with it, I would like to have a feedback >> Could you have a look at it and tell me what do you think about, please? >> >> http://greyfox.imente.org/index.php?id=73 > > Since Python 2.5 "try except else" and "try finally" got unified: > http://docs.python.org/ref/try.html > http://docs.python.org/whatsnew/pep-341.html Thank you, but that cheat sheet is about Python 2.4, not 2.5, so it should be correct. It's written into the article, maybe I should write it on the sheet too. -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
[EMAIL PROTECTED] ha scritto: > Looks cool, but you might find these interesting too: > > http://www.limsi.fr/Individu/pointal/python/pqrc/ > http://mail.python.org/pipermail/python-list/2006-June/386662.html > > Mike Thanks :) I'll read them to improve my python knowledge, but I prefere to have a very small cheat sheet to keep near me. -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Carl Banks ha scritto: > On Dec 27, 12:38 pm, "Riccardo T." <[EMAIL PROTECTED]> wrote: >> I wrote a little cheat sheet for this wonderful language, but because of >> my still little experience with it, I would like to have a feedback >> Could you have a look at it and tell me what do you think about, please? >> >> http://greyfox.imente.org/index.php?id=73 > > Nice work. I'm very glad you liked it :) > Only questionable thing I could see is listing dict.has_key(): I'm not > sure of it's officially deprecated but the recommended practice these > days is to to use "key in dict_obj". I listed it because of help(dict.has_key) doesn't show any warning about that. However, if "in" works as well, I'll remove it very soon. > Also, consider adding a line or two about the set objects. (It's > probably at least better than listing internal objects.) I forgot it... thank you very much. I hope I'll find some more space to write on. > Carl Banks -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Scott David Daniels ha scritto: > [in the .png] >> ... >> Callable types >>... >>User-definet methods > > I personally prefer "User-defined methods" That's a typo, thank you. >>... >>Class instances > I'd try: > Class instances with a __call__ method. Yes, it's more clear now. >> ... >> Classes >> Classes Instances > > This probably wants to be > Class Instances Whoops, I'm sorry :) > "file" objects are generally supposed to be built with the > open function, not instantiated as shown. Since open() is just an alias for file(), changing the name should be enough, right? > Also note iterating on a file gets the lines. What do you think about adding a line like this to the examples? for line in open("filename","r"): pass #iterate over lines > Do you know about seq[i:] and seq[::-1]? Yes I know. I'll try to add them (together with seq[:] and seq[:j]). Thank you very much indeed :) -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
c james ha scritto: > On the svg version, as viewed on firefox, the sections "Simple > statements", "Definations" and "Comments"; there appears to be a problem > with text wrapping. I see, it has already been signaled by mail. I'm not sure about how to fix that, I'll have to ask someone who knows Inkscape. Thanks. I'm working at the next release now, it should be available quite soon. -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Scott David Daniels ha scritto: > Riccardo T. wrote: >> Scott David Daniels ha scritto: >>> [in the .png] >>>> ... >>>> Callable types >>>>... >>>>User-definet methods >>> I personally prefer "User-defined methods" >> >> That's a typo, thank you. > > Hope I didn't offend (I was simply trying to be cute). > Some from a bit further along. I know I didn't say so > explicitly, but I don't spend much effort in pointing out > errors in useless things. No, you did't :) > --- > lambda is an expression, not a statement. I'll remove that from the expression list. > Might include callable-invocation in operators? > divmod, pow, int, long, float are in __builtin__, not math. Yes I know, it has already been signaled by mail. They will be removed in the next version, except pow (the version with two arguments that is in my list belongs to math, while pow(b,e,m) is from __builtin__). > Note pow(base, exponent[, modulus] is good for crypto stuff. > Useful modules to read actually should include __builtin__, > os, and os.path -- maybe include os.walk and os.path.join. Maybe I'll add __builtin__ and os in place of the type hierarchy, but I'm not sure about that. However, not in the next release. What do you think about? -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Alaric ha scritto: > Nicely done! I would suggest you put your website address on it and a revision > number so that as it gains use on te web, people can find the "latest" > version. That's a good idea, thank you :) -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Scott David Daniels ha scritto: > Riccardo T. wrote: >> Maybe I'll add __builtin__ and os in place of the type hierarchy, but >> I'm not sure about that. However, not in the next release. What do you >> think about? > > How about: > top line w/ __builtin__, os, os.path (and no contents -- inspire > further reading). I'm sorry, but what do you mean with "top line w/"? -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
ZeD ha scritto: > Michele Simionato wrote: > >> Python 2.4.4 (#2, Oct 4 2007, 22:02:31) > file is open >> True >> >> Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) > file is open >> False >> >> Nowadays file is no more an alias for open. > > curious... maybe it's me, but I can't find a "What's New in Python" where > this is said... also, in 2.6 docs (and also in 2.5) remains this footer: > > http://docs.python.org/dev/library/stdtypes.html#id14 > http://www.python.org/doc/2.5/lib/bltin-file-objects.html#foot4449 > > file() is new in Python 2.2. The older built-in open() is an alias for > file(). That's strange... however, since there are no doubts about open(), I'll use that :) -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheat sheet
Riccardo T. ha scritto: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfox.imente.org/index.php?id=73 > > -- > GreyFox Thanks to all your advices, the new version is now available. There's a new gif file with less graphic that you can download faster. -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list