News for hackers. Stuff that matters.
Re:Python Facts by cbo on Friday November 25, 2011 @04:38PM (#3278317)
Not just PEP8-compliant. Some of these are just plain bad.

The first one I was greeted with when I opened the site was:

> print eval('+'.join(map(str, [1, 1])))

If I ever saw this in production code, I would lose my mind.

It's the kind of one-liner I'd expect to find in an obfuscated code competition. It's not intuitively understood, shows a lack of basic Python functionality (the builtin sum() function), and most of all, it's SLOW. As in, 54 times slower than a simple sum -- tested on xrange(1,10) -- on my development Macbook Pro.

That said, clicking through some other examples, there are a lot of great Python examples on this site. Just beware of some of them, and always make sure you test new code yourself.

Re:Python Facts by gbog on Friday November 25, 2011 @08:03PM (#3278755)
Slowness is not the worst, eval is evil, and should be forbidden, that's all.
Re:Python Facts by shenberg on Friday November 25, 2011 @07:22PM (#3278675)
I'm pretty sure that one-liner is a joke...