PEP 318: Can't we all just get along?
Paul Morrow
pm_mon at yahoo.com
Wed Aug 18 08:35:21 EDT 2004
Dan Sommers wrote:
> On Tue, 17 Aug 2004 21:13:47 -0400,
> Paul Morrow <pm_mon at yahoo.com> wrote:
>
>
>>First though, I still believe that we should exploit existing
>>conventions (recommended coding practices) as a way of getting 'free'
>>declarations for class, static, and instance methods (e.g. methods
>>whose first param is 'self' are instance methods, etc.). That feels
>>very pythonic to me, just as we use naming conventions to distinguish
>>public, private, and semi-private methods.
>
>
> I don't understand how assigning semantic significance to a "recommended
> coding practice" is Pythonic.
>
> 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
When declarations conflict with conventions, it makes us wonder what the
author really intended.
def staticmethod setX(self, x):
self.x = x
>
> 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.
More information about the Python-list
mailing list