Pass-by-reference : Could a C#-like approach work in Python?

Daniel Dittmar daniel.dittmar at sap.com
Tue Sep 23 11:53:52 CEST 2003


Greg Ewing (using news.cis.dfn.de) wrote:
> However, as a convenience, we might want to allow the 'ref'
> keyword to be usable on the left hand side of an expression
> as well, in a kind of "unpacking" sense, so that
>
>     ref x = xref
>     x = y
>
> would be equivalent to
>
>     xref.set(y)

You're moving too close to overloadable assignment for my taste (as a
magical __assign__ method wouldn't even require the ref syntax). Don't
mention this when impressionable kids are around.

Daniel







More information about the Python-list mailing list