[melbourne-pug] Coding idiom

Tennessee Leeuwenburg tennessee at tennessee.id.au
Tue May 9 02:04:10 CEST 2006


>   
>> 	@public
>> 	def goForIt(self): pass
>>
>> Not very original. But is blindingly obvious what you mean. If you stick with 
>> this system one day you could code up something more snazzy than the identity 
>> function. 
>>
>> Personally I am against using underscores to  give subtle meanings, and I am 
>> glad we have decorators. Perhaps one day the magic underscore behaviour of 
>> import will be replaced with a decorator. 
>>     
>
> Perhaps I don't see underscores as being so subtle. I'm all for an
> explicit mechanism of telling someone that certain portions of the API
> are stable and will be honoured, while other parts are volatile or not
> for public consumption. I'm not a big fan of someone preventing me from
> getting something done because they've prematurely optimised their API,
> leaving out something I believe should be there, and then preventing me
> from doing it myself because they've locked down the private functions.
>
> If public/private/whatever is simply a sign placed near the function
> warning me that I'm doing something dangerous, then fine. I might have a
> very good reason for doing it, and be confident in my ability to do so.
> I don't want the software making it arbitrarily difficult for me to get
> something done.
>
> That's one of the reasons I love Python so much. It doesn't get in my
> way as much as C++ or Java or Eiffel.
>
>   

I strongly agree. I don't think using doXX(), _doXX(), and __doXX() are 
only subtly different. I think it's quite clear. It's nice and brief, a 
quick hint as to the intended use of the function.

I don't want to be prevented from doing things, nor do I want to have to 
catch interface violations at runtime "just in case" someone has used an 
interface. If I liked a language that strict, I'd use Java, because it's 
also powerful and supports all that junk/jazz.

Strong interfaces could kill python for hackers.

Decorators are not in themselves bad. I find them confusing and 
unnatural, but maybe that's just because I'm not used to them. However, 
using them for evil is evil -- and I think that it's evil to allow 
programmers to write uncallable methods.

Cheers
-T


More information about the melbourne-pug mailing list