Message21864
Logged In: YES
user_id=593130
Duh, my turn to forget. For any beginners reading this ...
>>> class ms(str): pass
...
>>> a=ms('a')
>>> type(''.join((a,)))
<class '__main__.ms'>
Expanding mhw's second point:
>>> e=ms()
>>> type(e)
<class '__main__.ms'>
>>> import copy
>>> e2=copy.copy(e)
>>> type(e2)
<class '__main__.ms'>
>>> e3=e[:]
>>> type(e3)
<type 'str'>
>>> id(e),id(e2),id(e3)
(9494608, 9009936, 8577440)
so [:] is not exactly an abbreviated synonym for copy(). Is
this a butg? (I haven't rechecked the respective docs yet.)
One reason I hesitate to call the OP's original observation a
bug is that the whole sujbect of operations on subtype
instances seems not completely baked. Knowing the result
types in all cases may require experiments as well as doc
reading. |
|
Date |
User |
Action |
Args |
2007-08-23 14:24:40 | admin | link | issue1001011 messages |
2007-08-23 14:24:40 | admin | create | |
|