Re: Re: Re: Re[2]: Re: class proposal
"Mark Hahn" <[email protected]> Thu, 15 Jul 2004 15:29:52 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <002d01c46abb$3f312330$0d01a8c0@MarkVaio> |
Christian Tismer wrote: > if not trousers.washed? > trousers.wash() > > this I can understand. > > But why should I ask trousers.washed?() I agree. I need to go through Prothon and change many things from methods into properties. I just added properties to Prothon last week and I haven't gone back and changed them yet. I will make it file.open() and file.open?. > 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. Hmm. It is interesting that you will be able to say file.open to get the method, but to get the property you will have to go to great trouble and say file.atrs_[$open?] or file.attrs_["open?"]. >> Python was forced to have file.closed(). > > Ho that? It was a decision. I would most probably have made > it into a computed attribute. Even if you did, you couldn't have used file.open, so you would have had to use file.closed. My point is that using the ? gave me the freedom to use the word open twice, once as a command and once as a question. >> 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 I can do the implicit computation and I will do it soon. My ? still solves a naming problem that Python can never solve.