Re: Re: Re: Re[2]: Re: class proposal
Christian Tismer <[email protected]> Fri, 16 Jul 2004 00:10:03 +0200
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote: > Christian Tismer wrote: > >>And in Prothon the "!" or bang symbol has a meaning: >>change an object in place and return it. Have you noticed >>the append! for lists, etc. >> >>Yes, sure. It may make sense, but it is really ugly for me. >>Another thing I might put into an editor: Hide or unhide the >>decoration characters. They could show up as colors. I'd >>extend my proposal to also disallow coexistence of the >>decorated with the undecorated version. Ahem :-) > > The ! And ? Characters in a name are not decorators, they are > significant. This is what allows us to have both File.open() and > File.open?(). Well, the question mark makes some sense to me, looks much friendlier than the shriek. Just a matter of taste. In any case, open? does not look like an attribute name, but like an attribute with a post fix operator, a little like the getter/setter interface with computed attributes in Python: inst.alpha calls the getter of the aplha attribute inst.alpha = 42 calls the setter of the alpha attribute but it is perceived as one thing. I would expect it as some decoration, different ways to look at the same thing. if not trousers.washed? trousers.wash() this I can understand. But why shoudl I ask trousers.washed?() And would it even exist without the (), probably yes, this would give me the method object. Well, here Python would use the trouser.__class__.washed unbound method. > Python was forced to have file.closed(). Ho that? It was a decision. I would most probably have made it into a computed attribute. > Not only is it harder to tell > which is a command and which is a question in Python, but you have the > illogical negative-based question in Python. Python has history, and computed attributes are not very old. If they had a chance, they would probably not make this into a method.again(). I see two different approaches here, one with special characters, one with the design decision to use a call or implicit computaton (and it has some historical problems of consistency), but I'm not sure which one to prefer. There is nothing telling me that it is *the right thing*(TM) now and forever, so why the change at all? My first (and still lasting) impression was that it will not buy you new users, but the opposite. definately?(both).not.what.I!(want) -- ciao - chis -- Christian Tismer :^) <mailto:[email protected]> Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/