PEP 318: Can't we all just get along?
Dan Sommers
me at privacy.net
Wed Aug 18 13:20:21 EDT 2004
On Wed, 18 Aug 2004 08:35:21 -0400,
Paul Morrow <pm_mon at yahoo.com> wrote:
> Dan Sommers wrote:
>> In the face of ambiguity, refuse to guess.
>> Explicit is better than implicit.
> Good conventions prevent ambiguity.
> class Foo:
> def method1(self, a, b): pass # clearly an instance method
> def method2(cls, a, b): pass # clearly a class method
> def method3(a, b): pass # clearly a static method
class Bar:
def method4( _, b ): pass # clearly a method
def method5( klass, b ): pass # clearly something else
def method6( uovo, b ): pass # clearly an Italian program(mer)
> When declarations conflict with conventions, it makes us wonder what
> the author really intended.
I agree completely. I have often noted that when a comment doesn't
match the code, they are *both* wrong.
If we wonder what the author intended, what should Python do?
>>
>> I think that the idea that started this thread is just right:
>>
> You're right, this thread is about decorators, not about more
> opportunities for dynamic typing. I just wanted to remind us that
> decorators are a lot like static typing, which isn't terribly
> pythonic.
I readily admit that my background is static typing: BASIC, FORTRAN,
assembly, C, etc.; my (arguably naïve) lisp and Python programs are
devoid of most of the dynamic typing I see here on c.l.p. OTOH, does
anyone want/need "dynamic decorators"? Is there a real use case for
code like this?
class C:
def m( self ): pass
m = decorate( m )
decorate = some_function
c1 = C( )
decorate = another_function
c2 = C( )
Regards,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
Never play leapfrog with a unicorn.
More information about the Python-list
mailing list