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/2005-February/051815.html below:

[Python-Dev] PEP 309 enhancements

[Python-Dev] PEP 309 enhancementsNick Coghlan ncoghlan at iinet.net.au
Mon Feb 28 13:25:02 CET 2005
Samuele Pedroni wrote:
> Nick Coghlan wrote:
> 
>> The initial suggestion was to provide a __get__ method on partial 
>> objects, which forces the insertion of the reference to self at the 
>> beginning of the argument list instead of at the end:
>>
>>     def __get__(self, obj, type=None):
>>         if obj is None:
>>             return self
>>         return partial(self.fn, obj, *self.args, **self.kw)
>>
> 
> just a note:
> 
> I don't see why this is not also a possible definition:
> 
> return partial(self.fn, *(self.args+(obj,)), **self.kw)
> 
> it may be impractical, but it would implement the direct mechanics of 
> partial should behave like a function.

It certainly *is* a possible definition, but you can get essentially that 
behaviour using new.instancemethod, so a new descriptor isn't necessary for that 
case.

The suggested descriptor was to get an alternate behaviour which injected the 
automatically supplied self argument at the start of the list of positional 
arguments.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net
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