This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jyasskin
Recipients jyasskin
Date 2008-02-14.18:01:36
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1203012098.28.0.839264314729.issue2115@psf.upfronthosting.co.za>
In-reply-to
Content
(On a MacBook Pro 2.33 GHz)

$ ./python.exe -m timeit -s 'class Foo(object): pass' -s 'f = Foo()'
'f.num = 3'
10000000 loops, best of 3: 0.13 usec per loop
$ ./python.exe -m timeit -s 'class Foo(object): __slots__ = ["num"]' -s
'f = Foo()' 'f.num = 3'
1000000 loops, best of 3: 1.24 usec per loop

Attribute reading isn't affected:
$ ./python.exe -m timeit -s 'class Foo(object): pass' -s 'f = Foo();
f.num = 3' 'g = f.num'
10000000 loops, best of 3: 0.107 usec per loop
$ ./python.exe -m timeit -s 'class Foo(object): __slots__ = ["num"]' -s
'f = Foo(); f.num = 3' 'g = f.num'
10000000 loops, best of 3: 0.101 usec per loop
History
Date User Action Args
2008-08-06 09:01:29georg.brandlsetspambayes_score: 0.762374 -> 0.0
2008-02-14 18:01:38jyasskinsetspambayes_score: 0.762374 -> 0.762374
recipients: + jyasskin
2008-02-14 18:01:38jyasskinsetspambayes_score: 0.762374 -> 0.762374
messageid: <1203012098.28.0.839264314729.issue2115@psf.upfronthosting.co.za>
2008-02-14 18:01:36jyasskinlinkissue2115 messages
2008-02-14 18:01:36jyasskincreate