A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-November/040538.html below:

[Python-Dev] "groupby" iterator

[Python-Dev] "groupby" iterator [Python-Dev] "groupby" iteratorGuido van Rossum guido at python.org
Sun Nov 30 19:18:37 EST 2003
> How about:
> 
> extract(attr='grade')
> extract(item=2)
> extract(method='foo')   # returns the result of calling 'ob.foo()'
> 
> And following the pattern of Zope's old "query" package:
> 
> extract(extract(attr='foo'), attr='bar')   # extracts ob.foo.bar
> extract(extract(item=10), method='spam')   # extracts ob[10].spam()
> 
> i.e., the first (optional) positional argument to extract is a function 
> that's called on the outer extract's argument, and the return value is then 
> used to perform the main extract operation on.

I'm not sure what the advantage of this is.  It seems more typing,
more explanation, probably more code to implement (to check for
contradicting keyword args).

> IIRC, the Zope query package used __getitem__ instead of __call__ on its 
> instances as a speed hack, but I don't think we should follow that example.  :)

Right. :)

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4