Suggesting for overloading the assign operator

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Jul 1 17:19:07 EDT 2003


> From: rimbalaya at yahoo.com [mailto:rimbalaya at yahoo.com] 
> Sent: Martes, 01 de Julio de 2003 12:07 p.m.
> 
> Well, what about the idea of providing another statement, the one I
> proposed in the original post?
> 
> '=' statement assigns type and value
> ':=' statement assigns value only
> 
> Rim
>

Probably the reason most prople on this list don't quite
like these threads is that there's no *need* for this
"value-assignment" operation.

For one, how would you implement it for immutable data
types?

This ":=" statement you're talking about already exists
for lists, you can do something like:

A[:] = some_other_list

Why?  Because you're assigning to a slice of A (which happens
to be the whole list) the contents of the second list.

But, what about strings, for example?  Or ints?  Or longs,
floats, complexes?  These data types are not mutable,
an int object like, for example, 123, cannot change it's
value to some other value, like 124.  It's created
with that value and lives like that until destroyed,
or the end of the program.  Same goes for all those
other immutable types mentioned above.

Why would you need such an operation?

Is there some unsurmountable programming problem that cannot
be solved except by such a vile hack as an overloadable
assignment operator?  The existance of huge software
projects already done in python (such as Zone, Yahoo,
and others) tells me that the language really doesn't
need it.

Another question would be, why not tell us what
you're trying to do (which most probably looks like
a C++ algorith or something like that) and how can
we help you turn it into a Python algorithm?

Programming C++ in Python is difficult.

-gustavo
Advertencia:La informacion contenida en este mensaje es confidencial y
restringida, por lo tanto esta destinada unicamente para el uso de la
persona arriba indicada, se le notifica que esta prohibida la difusion de
este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
la transmision, favor de comunicarse con el remitente. Gracias.





More information about the Python-list mailing list