Efficient python programming...

Shagshag13 shagshag13 at yahoo.fr
Fri Jun 7 02:47:33 EDT 2002


"gabor" <gabor at realtime.sk> a écrit dans le message de news: mailman.1023401650.18434.python-list at python.org...

> but if you want to know about specific python issues, then you have to
> learn things like "dictionary are very well optimized etc.."

That's what i'm asking : learning and understanding... but where should i go ???

I'm wondering if there is a place to go to find "why this solution is better in this
appropriate case... ". For example, i was looking for the best pythoner's way to
remove duplicate in a list, and after reading many posts, i find at the end of a
cookbook recipe that it was :

set = {}
map(set.__setitem__, alist, [])
alist = set.keys()

But that's not trivial !!! And quite difficult to find...

> those things doesn't make your code obfuscated..

I agree :)

> [file.printsize() for file in directory]
>
> they're the same, and everyone would recommend you the last one..

Yes but i would have asked why this is the best... And i think that
your answer would have helped me to become a better pythoner...

I mean there should be a place to go where you could read generalities
like "as dictionary are very well optimized, you can use it without
trouble and for example it's best in : removing duplicates, ..." or
"if you need to do an operation on a list use map because it's
c-optimized", there are "object overhead if you...", and so on
that's not in the books, that's not in 'dive in python',
it's spreaded in Guido's essays, and posts over there... But i worry,
you could miss it if you don't spend many time to search, and say
"there should be a place for that"...

> so to summarize this: what do you want to know/learn?

What a beginner should learn to do it the pythoner way...

s13.

ps : and sorry for my poor english and typos...





More information about the Python-list mailing list