tag:blogger.com,1999:blog-4195135246107166251.post9216930950165013030..comments2023-05-08T07:04:09.641-07:00Comments on Neopythonic: The depth and breadth of PythonGuido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-4195135246107166251.post-38433132397775472292012-11-29T11:16:54.478-08:002012-11-29T11:16:54.478-08:00I think pattern matching would be a great addition...I think pattern matching would be a great addition to Python. I did a small experiment implementing it as an external library (here: http://github.com/martinblech/pyfpm) but the new syntax requires a parser of its own. Language-level support would be much better. Still, pyfpm lets you do stuff like:<br /><br />unpacker('head :: tail') << (1, 2, 3)<br />unpacker.head # 1<br />unpacker.tail # (2, 3)<br /><br />or<br /><br />@match_args('head :: tail')<br />def match(head, tail):<br /> return head, tail<br /><br />match([1, 2, 3]) # (1, (2, 3))Martin Blechhttps://www.blogger.com/profile/07428573128593874572noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-49586426954725532572011-07-02T09:13:12.157-07:002011-07-02T09:13:12.157-07:00I would like to thank Guido van Rossum for Python....I would like to thank Guido van Rossum for Python. I am a student of computer science and started python 3 weeks ago and now my world is changed. Honestly I never learned anything with such joy like Python. In python I feel like everything is possible to solve. .......<br /><br />Thanks Guido van Rossum ...you are my favorite person.sunny1304https://www.blogger.com/profile/15662215984492828906noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-51591979910689100212011-07-02T09:11:47.657-07:002011-07-02T09:11:47.657-07:00I would like to thank Guido van Rossum for Python....I would like to thank Guido van Rossum for Python. I am a student of computer science and started python 3 weeks ago and now my world is changed. Honestly I never learned anything with such joy like Python. In python I feel like everything is possible to solve. .......<br /><br />Thanks Guido van Rossum ...you are my favorite person.sunny1304https://www.blogger.com/profile/15662215984492828906noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-87762382723277139932011-06-24T14:06:55.608-07:002011-06-24T14:06:55.608-07:00Seize the day Guido, just make sure everything you...Seize the day Guido, just make sure everything you do in your life is pure enjoyment! (And I bet it is!)<br /><br />I'll just quote this lyric from a song. (http://www.pubnub.com/blog/internet-heroes-song-crockford-dahl-wall-torvalds-resig-souders)<br /><br />"Guido Van Rossum, thanks for the Python. More like Van Awesome, maybe Van Right On."Shuphaninhttps://www.blogger.com/profile/12519602116759073100noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-47120361508202148122011-06-11T05:00:34.254-07:002011-06-11T05:00:34.254-07:00Another +1 for pattern matching arguments.
What a...Another +1 for pattern matching arguments.<br /><br />What about something like <br /><br />def f([h,*t]) :<br /><br />for cutting up lists? It's close enough to [H|T] and consistent with *args notation.<br /><br />Empty lists would still be [].Composinghttps://www.blogger.com/profile/01739889615635395138noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-29841014503548707352011-06-10T09:37:19.674-07:002011-06-10T09:37:19.674-07:00Sorry, Unladen Swallow is dead: http://qinsb.blogs...Sorry, Unladen Swallow is dead: http://qinsb.blogspot.com/2011/03/unladen-swallow-retrospective.htmlGuido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-70119807760670750192011-06-10T09:12:33.716-07:002011-06-10T09:12:33.716-07:00By the way, Python and numpy "sum" are a...By the way, Python and numpy "sum" are also incompatible. E.g. Python:<br /><br />>>> sum([1,2],-1)<br />2<br />Now suppose a programmer replaced in a Python file header "from numpy import func1, func2, ..." by "from numpy import *", or imported "sum" from numpy to perform his own operations somewhere in his part of the file. Then somewhere in other part of the file we'll get <br /><br />>>> from numpy import *<br />>>> sum([1,2],-1)<br />3<br /><br />It can be obtained in most inappropriate time and be very hard to find the error (or even worse, it can be not revealed at all).<br /><br />As for the predicates check, I think it's better to handle them in more lower level (e.g. C language), and possibly to have it parallel computed (at least, by default or by an optional argument). On the other hand, maybe it's better to wait with all those parallel computations changes till Python 3.3 where LLVM-based JIT will be implemented (I hope it will be already done that time, isn't it?)Dmitreyhttps://www.blogger.com/profile/18259817544023299492noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-24511822191932187992011-06-10T08:19:06.192-07:002011-06-10T08:19:06.192-07:00Well, at first, it will bring some backward incomp...Well, at first, it will bring some backward incompatibility to previous numpy versions, at second, I'm not a NumPy developer and thus cannot affect decisions they make. Thus here I mere want to prevent appearing of another one incompatibility. Checking predicates along axis of n-dimensional array will certainly be used very often in scientific/engineering Python software to speedup calculations instead of using "all"/"any" along the involved axis. <br /><br />Sometimes I wonder what NumPy developers do (they often doesn't care even about bug reports I inform), but of course it's absolutely up to them. For example, one of most essential task numpy certainly require - possibility for downloading it from easy_install or linux channels (e.g. apt-get) with ACML (for AMD processors, free of charge and without royalites) or MKL (Intel processors, free-for-educational) (currently it requires lots of makefile changes and other efforts). But since Enthought (who sponsor numpy and thus affect their decisions) included MKL into their EPD, they seems to be not interested of it any longer - they prefer to force people buy their EPD with MKL than having it easily available with numpy download for free.Dmitreyhttps://www.blogger.com/profile/18259817544023299492noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-91063195285089981012011-06-10T07:52:59.779-07:002011-06-10T07:52:59.779-07:00@Dmitrey: we're getting pretty far off-topic h...@Dmitrey: we're getting pretty far off-topic here, but I suggest that NumPy was in the fault by redefining min() and max() that way. This could be avoided by requiring a keyword for axis, e.g. max(a, axis=0). Perhaps NumPy can evolve in this direction?Guido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-61244716085949815282011-06-10T03:33:32.030-07:002011-06-10T03:33:32.030-07:00Some proposition to yield "SOME x IN xs HAS p...Some proposition to yield "SOME x IN xs HAS pred" and "EACH x IN xs HAS pred" on existing Python language programming constructs, mentioned in answers, definitely will suffer by lack of performance. I have awful lot of "all" and "any" in my Python mathematical code (OpenOpt, FuncDesigner), and both Pyhon and numpy versions of "all" and "any" suffer the mentioned drawback of evaluating all elements before yielding result, while very often checking only several elements would be enough. <br /><br />The thing I would like you to pay attention - it would be very essential to get the new Python constructs numpy-style compatible, where "all" and "any" often are evaluated along a chosen dimension of n-dimensional array (e.g. all(X==10, axis=1) or mere all(X==10, 1)). <br /><br />Incompatibility between numpy and Python "min" and "max" styles already is a terrible headache, especially for newbies. It's very hard to find the bug. Python max(-1,0) is 0, while numpy treats max(-1,0) as max of array with single element "-1" along axis 0 and thus result is -1.<br /><br />I hope it will be taken into account to reduce numpy-python incompatibility.Dmitreyhttps://www.blogger.com/profile/18259817544023299492noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-63932376305091857952011-06-07T20:21:23.154-07:002011-06-07T20:21:23.154-07:00I wish I'd kept journals! No, I just searched...I wish I'd kept journals! No, I just searched my GMail for "Robert Dewar" and found a message from 2005 where I had summarized the story as I had heard it then and sent it off to an old colleague (who didn't reply).Guido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-83615375867683150652011-06-07T18:57:28.453-07:002011-06-07T18:57:28.453-07:00Quick question: when you said you "checked yo...Quick question: when you said you "checked your personal archives" per the indentation question, were you going back and reading journals that you'd kept or simply browsing over old mail?<br /><br />I ask because I'm curious as to how you record, organize, and store your thoughts.James O'Beirnehttps://www.blogger.com/profile/14136602255570212323noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-67205197444788885672011-06-06T03:55:46.179-07:002011-06-06T03:55:46.179-07:00Oh! Pattern Matching. Guido, please give us patter...Oh! Pattern Matching. Guido, please give us pattern matching. It makes life so much more beautiful in Erlang. With Python being a thing of beauty, it must must must have Pattern Matching.Yousufhttps://www.blogger.com/profile/05500079710236095794noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-86694392619724166262011-06-04T23:30:46.722-07:002011-06-04T23:30:46.722-07:00Besides all the stories about some important decis...Besides all the stories about some important decision making, it's really cool to see how some of the best ideas are coming from interacting with other people.<br />So I totally agree with "focus on two things: meeting Python users and coding. That's the life!"<br />I find programming less fun without interacting with other people. I guess it's all about sharing ideas and coming up with great solutions together. It probably makes us feel like a better programmer as well as a better human being.<br /><br />Thank you for sharing your ideas about programming and life in general, Guido! Good luck!<br /><br />PS: Robert Dewar's wife should be given an award for her input on the greatest programming language of all! ;)Zaheer Soebhanhttps://www.blogger.com/profile/06511641786038809446noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-47818247242250895272011-06-04T18:24:48.555-07:002011-06-04T18:24:48.555-07:00Why not have arb() behave like next(iterator[, def...Why not have arb() behave like next(iterator[, default])? (Throw by default, but a value can be specified.)Roger Patehttps://www.blogger.com/profile/03962218661157805538noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-66524808718035801142011-06-04T08:24:50.414-07:002011-06-04T08:24:50.414-07:00@Ralph Corderoy: xs is typically a set or dict so ...@Ralph Corderoy: xs is typically a set or dict so no index is needed. And the suggestion of "some" (or "any" for that matter) that it's an arbitrary element is intentional, since loops over sets/dicts use an arbitrary order.<br /><br />Which reminds me, Annie also asked for an arb() function that is like Ian's first(). It's been discussed on python-dev in the past, but we could never agree on what it should return if the collection is empty. None feels wrong because the collection could very well contain None as a legitimate value.Guido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-86675067851356309902011-06-04T05:12:42.452-07:002011-06-04T05:12:42.452-07:00Hi Guido. This "while some x in xs has pred:...Hi Guido. This "while some x in xs has pred:", will x on each iteration be the first element of xs where pred(x) and xs needs changing each iteration? If so, we've only x, and not its index to be able to efficiently alter xs. Also, "some" doesn't emphasise first and is more suggestive of a x where pred(x) being plucked at random. Cheers, Ralph.<br /><br />P.S. Isn't an upside-down E an E by another name? :-)Ralph Corderoyhttps://www.blogger.com/profile/13140975971019765573noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-83206337451230547592011-06-04T04:40:03.136-07:002011-06-04T04:40:03.136-07:00@Carl
You can already use: any(ident(x) for x in i...@Carl<br />You can already use: any(ident(x) for x in iterable)Laurence Rowehttps://www.blogger.com/profile/02164563755538372331noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-3320073822995412872011-06-04T04:27:56.104-07:002011-06-04T04:27:56.104-07:00Sounds awesome.Sounds awesome.Nickhttps://www.blogger.com/profile/12423314460104837866noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-68475056175019988062011-06-03T21:11:34.177-07:002011-06-03T21:11:34.177-07:00As far as I can tell, wouldn't an optional sec...As far as I can tell, wouldn't an optional second arg to any() do the job for SOME:<br /><br />def any(iterable, fn = ident):<br /> for x in iterable:<br /> if fn(x):<br /> return True<br /> return FalseCarlhttps://www.blogger.com/profile/02356685283400181363noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-62857426856306868122011-06-03T20:46:11.272-07:002011-06-03T20:46:11.272-07:00As we're talking about language requests:
Some...As we're talking about language requests:<br />Something that really could be done but probably won't are ranges in the form 1..10. :)<br /><br />As Ellipsis took the triple dot syntax a ruby-like range can't be made.<br /><br />BTW, I always tought it was inconsistent to have mylist[1:5] but 1:5 alone don't work as a range.<br /><br />Just toughts... :PJoão Bernardohttps://www.blogger.com/profile/03879959110533123024noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-91530275376360883952011-06-03T19:05:40.588-07:002011-06-03T19:05:40.588-07:00Thought about any(): it might have been interestin...Thought about any(): it might have been interesting to have it return either an empty tuple (if False) or a 1-tuple containing the value (if True). Too late for that now, though.<br /><br />Regarding while/if: Perhaps it's time to revisit the idea of an 'as' clause on these conditionals (the tuple trick above could handle the cases where the condition and required value inside the clause don't match up)<br /><br />As far as immutability goes, perhaps someone would care to take the freeze() PEP back up (PEP 351)Anonymoushttps://www.blogger.com/profile/14824694805745746190noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-7718669600949667952011-06-03T17:26:45.065-07:002011-06-03T17:26:45.065-07:00Please dont turn commenting off: they are very int...Please dont turn commenting off: they are very interestingTonyhttps://www.blogger.com/profile/17148802215264428554noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-88821585156649408832011-06-03T15:00:08.207-07:002011-06-03T15:00:08.207-07:00One more flame about dropbox v. spideroak (or othe...One more flame about dropbox v. spideroak (or other competitors) and I'll turn off commenting and delete all comments about that topic.Guido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-4195135246107166251.post-44476447749258033472011-06-03T14:41:39.781-07:002011-06-03T14:41:39.781-07:00@Snagglepants
Apparently the Dropbox fan's hav...@Snagglepants<br />Apparently the Dropbox fan's have more in common with Apple users then previously believed. <br /><br />Tacky? Dude, you might want to read up on netiquette and buy a dictionary.Daniel Larssonhttps://www.blogger.com/profile/12637644206343765794noreply@blogger.com