Op 24-11-13 12:03, Peter Otten schreef:
> Antoon Pardon wrote:
>
>> Op 23-11-13 10:01, Peter Otten schreef:
>>
>>>
>>> Your script is saying that a staticmethod instance is not a callable
>>> object. It need not be because
>>>
>>> Foo.foo()
>>>
>>> doesn't call the Foo.foo attribute directly, it c
Op 24-11-13 11:43, Peter Otten schreef:
> Antoon Pardon wrote:
>
>> Foo.foo() being legal and Foo.foo not being callable is IMO a bug in
>> python.
>
> Foo.foo() is legal, and Foo.foo is callable.
Indeed, I had a kink in my brain which made it difficult to see
where I was going wrong myself. So
On Sun, 24 Nov 2013 11:30:14 +0100, Antoon Pardon wrote:
> Foo.foo() is legal here. So Foo.foo is callable.
Incorrect. Foo.foo() is legal for *any* identifiers Foo and foo. Since
Python is an extremely dynamic language, the compiler cannot (easily, or
at all) prohibit "illegal" combinations. T
Antoon Pardon wrote:
> Op 23-11-13 10:01, Peter Otten schreef:
>
>>
>> Your script is saying that a staticmethod instance is not a callable
>> object. It need not be because
>>
>> Foo.foo()
>>
>> doesn't call the Foo.foo attribute directly, it calls
>>
>> Foo.foo.__get__(None, Foo)()
>
> I t
On Sun, Nov 24, 2013 at 3:30 AM, Antoon Pardon
wrote:
> Op 23-11-13 22:51, Peter Otten schreef:
>> Antoon Pardon wrote:
>>
>>> Op 23-11-13 10:01, Peter Otten schreef:
>>>
Your script is saying that a staticmethod instance is not a callable
object. It need not be because
Fo
Antoon Pardon wrote:
> Foo.foo() being legal and Foo.foo not being callable is IMO a bug in
> python.
Foo.foo() is legal, and Foo.foo is callable.
--
https://mail.python.org/mailman/listinfo/python-list
Op 23-11-13 22:51, Peter Otten schreef:
> Antoon Pardon wrote:
>
>> Op 23-11-13 10:01, Peter Otten schreef:
>>
>>>
>>> Your script is saying that a staticmethod instance is not a callable
>>> object. It need not be because
>>>
>>> Foo.foo()
>>>
>>> doesn't call the Foo.foo attribute directly, it c
Antoon Pardon wrote:
> Op 23-11-13 10:01, Peter Otten schreef:
>
>>
>> Your script is saying that a staticmethod instance is not a callable
>> object. It need not be because
>>
>> Foo.foo()
>>
>> doesn't call the Foo.foo attribute directly, it calls
>>
>> Foo.foo.__get__(None, Foo)()
>
> I t
On Sun, Nov 24, 2013 at 2:00 AM, Antoon Pardon
wrote:
> IMO if Foo.foo() is legal then Foo.foo is callable. That the actual call
> is delegated to Foo.foo.__get__(None, Foo) shouldn't matter.
I absolutely agree. But isn't that already the case? I seem to be
missing something here.
>>> class Foo:
Op 23-11-13 10:01, Peter Otten schreef:
>
> Your script is saying that a staticmethod instance is not a callable object.
> It need not be because
>
> Foo.foo()
>
> doesn't call the Foo.foo attribute directly, it calls
>
> Foo.foo.__get__(None, Foo)()
I think you are burdening the programmer
Marco Buttu wrote:
> On 11/23/2013 10:01 AM, Peter Otten wrote:
>
>>> In Python 3 the following two classes should be equivalent:
>> Says who?
>>
>>> >$ cat foo.py
>>> >class Foo:
>>> > def foo():
>>> > pass
>>> > print(callable(foo))
>>> >
>>> >class Foo:
>>> > @staticmet
On Sat, 23 Nov 2013 09:28:43 +0100, Marco Buttu wrote:
> In Python 3 the following two classes should be equivalent:
They certainly are not equivalent in *any* version of Python, because
staticmethods are not equivalent to instance methods.
> $ cat foo.py
> class Foo:
> def foo():
>
On 11/23/2013 10:01 AM, Peter Otten wrote:
In Python 3 the following two classes should be equivalent:
Says who?
>$ cat foo.py
>class Foo:
> def foo():
> pass
> print(callable(foo))
>
>class Foo:
> @staticmethod
> def foo():
> pass
> print(callable(f
Marco Buttu wrote:
> In Python 3 the following two classes should be equivalent:
Says who?
> $ cat foo.py
> class Foo:
> def foo():
> pass
> print(callable(foo))
>
> class Foo:
> @staticmethod
> def foo():
> pass
> print(callable(foo))
>
> But they do
In Python 3 the following two classes should be equivalent:
$ cat foo.py
class Foo:
def foo():
pass
print(callable(foo))
class Foo:
@staticmethod
def foo():
pass
print(callable(foo))
But they do not:
$ python3 foo.py
True
False
How come the metaclass does n
15 matches
Mail list logo