Is it just Syntactic Sugar ?
Thomas Wouters
thomas at xs4all.net
Tue May 30 15:39:57 EDT 2000
More information about the Python-list mailing list
Tue May 30 15:39:57 EDT 2000
- Previous message (by thread): Is it just Syntactic Sugar ?
- Next message (by thread): Is it just Syntactic Sugar ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, May 30, 2000 at 05:18:56PM +0000, Thomas Palmer wrote: > Bjorn Pettersen wrote: > > [Guido] has considered a += method. It would require adding more > > 'magic' methods however, so there is still some resistance... > Not really. As syntactic sugar, it is just a rewrite. > i += 1 (or i++ for that matter) would be rewriten to > i = i + 1. Whether memory addresses were cached for > optimization is another issue, but the point is that > only '__add__' needs overwritten still. The compiler > would just rewrite the code. Well, if it is only a rewrite, it is *completely* useless. Since when does Python care about syntactic sugar ? I personally am beginning to detest the `object` sugar to represent repr(object), because it seems so very unpythonic (I'd be much obliged if anyone could give me a reason for ``, other than the usual hysterical raisin ;-) Adding ++/+= et al as rewrites would be horrifying. No, I have more faith in the idea that += is an *in place* add, for mutable types. It does require more __magic__(), but in my (maybe not too humble at this moment) opinion, it's bloody well worth it. I dont know what the __magic__ names would be, as __addeq__ seems out of place (we're talking about assignment, or mutation, not equality) but i'm sure someone can think of a couple of good names ;-P __addass__'ly yr's, -- Thomas Wouters <thomas at xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
- Previous message (by thread): Is it just Syntactic Sugar ?
- Next message (by thread): Is it just Syntactic Sugar ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list