[ python-Bugs-1382815 ] len() on class broken

SourceForge.net noreply at sourceforge.net
Fri Dec 16 22:40:43 CET 2005


Bugs item #1382815, was opened at 2005-12-16 22:38
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1382815&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Kevin Quick (kquick)
Assigned to: Nobody/Anonymous (nobody)
Summary: len() on class broken

Initial Comment:
With the following python input:

class A:
    @classmethod
    def __len__(cls):
        return 12

print '1',A.__len__()
print '2',A().__len__()
print '3',len(A())
print '4',len(A)

The output always breaks for '4' with 'TypeError: len 
of unsized object'

Same result for @staticmethod or normal instance method 
declaration.


----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-12-16 22:40

Message:
Logged In: YES 
user_id=1188172

Duplicate of #1382740.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1382815&group_id=5470


More information about the Python-bugs-list mailing list