Looking for assignement operator

Bruno Desthuilliers onurb at xiludom.gro
Tue Oct 17 10:35:43 EDT 2006


Steven D'Aprano wrote:
> On Tue, 17 Oct 2006 15:50:47 +0200, Alexander Eisenhuth wrote:
> 
>> Hello,
>>
>> is there a assignement operator, that i can overwrite?
> 
> No.
> 
> We were just discussing the reasons why Python will not and can not have
> an assignment operator just a few days ago. Check the archives for more
> details.
> 
> 
>> class MyInt:
>> 	def __init__(self, val):
>> 		assert(isinstance(val, int))
> 
> isinstance() considered harmful:

Trying to convert val to an int would probably be better indeed:

class MyInt(object):
  def __init__(self, val):
    self.val = int(val)

My 2 cents
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list