5 ms·
I couldn't help but feel irritated by this document. It's cute and all, but it implies Python is somehow unique—culturally or technologically—in grasping at the
by KirinDave 16y ago
I couldn't help but feel irritated by this document. It's cute and all, but it implies Python is somehow unique—culturally or technologically—in grasping at these concepts. You could easily have written this as a Ruby or Scheme manifesto with nearly identical wording and had a valid message.
And then, in our very first example, there is a use of lambda, a misnomer of a concept Python doesn't really support? My brow furrowed slightly more.
I can't help but feel like these people are celebrating their investment in their tools rather than the virtues of the tools themselves.
- rmc 16y agoYou could easily have written this as a Ruby or Scheme manifesto Yes, but this practically is the Python manifesto.
- KirinDave 16y agoI'm saying it's also the Scheme manifesto.
- petsos 16y agoNobody is saying that this advice is unique to Python. Feel free to use it for Visual Basic too if you want.
- mapleoin 16y agoIt might be also the Scheme manifesto, but in Python its so deep rooted in the community that its practically embedded in the language itself: Python 2.6.5 (r265:79063, Oct 28 2010, 20:56:23) [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. ...
- TheBoff 16y agoThe first section is pointing out list comprehensions as a better syntax than lambda, I believe. Also, the zen of python has been around for a long time: http://www.python.org/dev/peps/pep-0020/ http://www.python.org/dev/peps/pep-0020/. There's an import statement that will print it I believe, but I'm not sure exactly what it is.
- ronnix 16y ago$ python -c "import this"
- KirinDave 16y agoIt's a better syntax than Python's 10-year-out-of-date notion of lambda. For example, this is what a more modern language does with lambdas: numbers.filter( _ % 2 == 0 ) This document is old, so we can probably excuse it... but how many Python folks know that?
- d0mine 16y agoWhat is the language? numbers.filter( _ % 2 == 0 ).map( _ / 2 ) Zen of Python doesn't contain any lambdas (the link from the grandparent http://www.python.org/dev/peps/pep-0020/ http://www.python.org/dev/peps/pep-0020/ ). List Comprehensions are 10 years old http://www.python.org/dev/peps/pep-0202/ http://www.python.org/dev/peps/pep-0202/ How do you write: lambda x, y=1: x+y lambda *args: reduce(lcm, args) lambda **kwargs: kwargs.get('a') or kwargs.get('b') def lcm(a, b): return a*b // gcd(a, b) def gcd(a, b): while b: a, b = b, a % b return a
- KirinDave 16y agoThe link for the thread: http://artifex.org/~hblanks/talks/2011/pep20_by_example.py.txt http://artifex.org/~hblanks/talks/2011/pep20_by_example.py.t... It does indeed mention a lambda in the very first example, if only as a competition with list comprehension syntax. But even Python's list comprehensions look a little dated now.