Re: Replacing 'if __name__ == __main__' with decorator (was: Double underscores -- ugly?)

2008-02-23 Thread castironpi
> @mainmethod > def main(...) > > and like this: > > @mainmethod(parser=myparser) > def main(...) > > then you cannot use that decorator for a function that expects or > allows a function as its first argument? Because how and If it's called with only one non-keyword parameter, then the language m

Re: Double underscores -- ugly?

2008-02-21 Thread benhoyt
> Has anyone thought about alternatives? Is there a previous discussion > on this I can look up? Okay, I just emailed the BDFL and asked if he could tell me the origin of the double underscore syntax for __special__ methods, and what he said I'm pretty sure he won't mind me posting here: > [Guid

Replacing 'if __name__ == __main__' with decorator (was: Double underscores -- ugly?)

2008-02-21 Thread grflanagan
On Feb 19, 10:01 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Berwyn <[EMAIL PROTECTED]> wrote: > >> Is it just me that thinks "__init__" is rather ugly? Not to mention > >> "if __name__ == '__main__': ..."? > > > That ugliness has long been my biggest bugbear with python, too. The > > __name__ =

Re: Double underscores -- ugly?

2008-02-21 Thread cokofreedom
On Feb 21, 3:31 am, [EMAIL PROTECTED] wrote: > On Feb 19, 8:20 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Feb 19, 10:26 am, Wildemar Wildenburger > > > <[EMAIL PROTECTED]> wrote: > > >> Jason wrote: > > >>> Hmm. I must be the only person who doesn't thi

Re: Double underscores -- ugly?

2008-02-20 Thread castironpi
On Feb 19, 8:20 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 19, 10:26 am, Wildemar Wildenburger > > <[EMAIL PROTECTED]> wrote: > >> Jason wrote: > >>> Hmm.  I must be the only person who doesn't think the double > >>> underscores are ugly. > >> Nope. I like the

Re: Double underscores -- ugly?

2008-02-20 Thread Steven D'Aprano
On Tue, 19 Feb 2008 21:50:33 -0800, Ivan Illarionov wrote: > I would like to see something like %init or &init to be converted to > __init__ behind the scenes. Unfortunately -- or perhaps fortunately -- % clashes with the already established uses of % as the modulus operator for numbers and the

Re: Double underscores -- ugly?

2008-02-20 Thread Steven D'Aprano
On Wed, 20 Feb 2008 03:12:39 -0800, cokofreedom wrote: > So people's problem with __word__ is that it is not very readable? > > How so, it stands out on page, it clearly is different from other > objects and doesn't abuse other symbols that generally have a meaning > based on their use. > > I ha

Re: Double underscores -- ugly?

2008-02-20 Thread Ben Finney
[EMAIL PROTECTED] writes: > So people's problem with __word__ is that it is not very readable? No, the complaint seems to be that it's "ugly". -- \ "[T]he speed of response of the internet will re-introduce us | `\to that from which our political systems have separated us for | _o_

Re: Double underscores -- ugly?

2008-02-20 Thread cokofreedom
So people's problem with __word__ is that it is not very readable? How so, it stands out on page, it clearly is different from other objects and doesn't abuse other symbols that generally have a meaning based on their use. I haven't seen a single alternative that really stands out as much as __wo

Re: Double underscores -- ugly?

2008-02-20 Thread Bruno Desthuilliers
benhoyt a écrit : >>> Then again, what's stopping us just using a single leading underscore? >>> Nobody calls their own private methods _init or _add >> You must be looking at different code from the rest of us. A single >> leading underscore on the name *is* the convention for "this attribute >> i

Re: Double underscores -- ugly?

2008-02-20 Thread Bruno Desthuilliers
benhoyt a écrit : (snip) > Then again, what's stopping us just using a single leading underscore? > Nobody calls their own private methods _init or _add I do. -- http://mail.python.org/mailman/listinfo/python-list

Re: Double underscores -- ugly?

2008-02-20 Thread Bruno Desthuilliers
Jason a écrit : (snip) > Hmm. I must be the only person who doesn't think the double > underscores are ugly. As far as I'm concerned, I just don't care if they are "ugly" or not - FWIW, I never ever think of them in terms of "beauty" or "ugliness". What I do care about is that they simply and

Re: Double underscores -- ugly?

2008-02-20 Thread Jorge Godoy
Ivan Illarionov wrote: > I would like to see something like %init or &init to be converted to > __init__ behind the scenes. And $something to be converted to > self.something. But, unfortunately, most Python people would consider > this ugly just because Perl uses too much syntactic sugar and anyt

Re: Double underscores -- ugly?

2008-02-20 Thread Ben Finney
Please preserve attribution lines on the quoted material, so we can see who wrote what at each level. benhoyt <[EMAIL PROTECTED]> writes: > > > Then again, what's stopping us just using a single leading > > > underscore? Nobody calls their own private methods _init or _add > > > > You must be loo

Re: Double underscores -- ugly?

2008-02-20 Thread benhoyt
> > Then again, what's stopping us just using a single leading underscore? > > Nobody calls their own private methods _init or _add > > You must be looking at different code from the rest of us. A single > leading underscore on the name *is* the convention for "this attribute > is not part of the

Re: Double underscores -- ugly?

2008-02-19 Thread Ben Finney
Ivan Illarionov <[EMAIL PROTECTED]> writes: > I would like to see something like %init or &init to be converted to > __init__ behind the scenes. I would prefer that the names I create and see in the code are the names actually used by the Python runtime, with no magic name conversion "behind the

Re: Double underscores -- ugly?

2008-02-19 Thread Ivan Illarionov
I would like to see something like %init or &init to be converted to __init__ behind the scenes. And $something to be converted to self.something. But, unfortunately, most Python people would consider this ugly just because Perl uses too much syntactic sugar and anything Perl-like is considered ugl

Re: Double underscores -- ugly?

2008-02-19 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > My editor actually renders them as miniature chess pieces. The > bartender said she runs a pre-execution step, that searches and > replaces a double-colon with the underscores. I'm sorry, did you hit your head before dashing off your recent posts or something? -- Er

Re: Double underscores -- ugly?

2008-02-19 Thread Ben Finney
benhoyt <[EMAIL PROTECTED]> writes: > Then again, what's stopping us just using a single leading underscore? > Nobody calls their own private methods _init or _add You must be looking at different code from the rest of us. A single leading underscore on the name *is* the convention for "this attr

Re: Double underscores -- ugly?

2008-02-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 19, 10:26 am, Wildemar Wildenburger > <[EMAIL PROTECTED]> wrote: >> Jason wrote: >>> Hmm. I must be the only person who doesn't think the double >>> underscores are ugly. >> Nope. I like them too. :) >> >> Frankly, I think it's just a matter of adaption. I too fou

Re: Double underscores -- ugly?

2008-02-19 Thread benhoyt
> My editor actually renders [underscores] as miniature chess pieces. > The bartender said she runs a pre-execution step, that searches and > replaces a double-colon with the underscores. Heh, that makes me think. Great use for character encodings! Just like Tim Hatch's "pybraces", we could use a

Re: Double underscores -- ugly?

2008-02-19 Thread castironpi
On Feb 19, 10:26 am, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Jason wrote: > > Hmm.  I must be the only person who doesn't think the double > > underscores are ugly. > > Nope. I like them too. :) > > Frankly, I think it's just a matter of adaption. I too found it rather > "ugly" in the be

Re: Double underscores -- ugly?

2008-02-19 Thread Ben Finney
Marco Mariani <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > >> I realise that double underscores make the language conceptually > >> cleaner in many ways (because fancy syntax and operator overloading > >> are just handled by methods), but they don't *look* nice. > > > > That's a good thing

Re: Double underscores -- ugly?

2008-02-19 Thread Hyuga
On Feb 19, 4:01 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Berwyn <[EMAIL PROTECTED]> wrote: > >> Is it just me that thinks "__init__" is rather ugly? Not to mention > >> "if __name__ == '__main__': ..."? > > > That ugliness has long been my biggest bugbear with python, too. The > > __name__ ==

Re: Double underscores -- ugly?

2008-02-19 Thread Wildemar Wildenburger
Jason wrote: > Hmm. I must be the only person who doesn't think the double > underscores are ugly. Nope. I like them too. :) Frankly, I think it's just a matter of adaption. I too found it rather "ugly" in the beginning, but with anything, I've gotten used to it. (And I wholeheartedly support

Re: Double underscores -- ugly?

2008-02-19 Thread Jason
On Feb 18, 3:28 pm, benhoyt <[EMAIL PROTECTED]> wrote: > Hi guys, > > I've been using Python for some time now, and am very impressed with > its lack of red tape and its clean syntax -- both probably due to the > BDFL's ability to know when to say "no". > > Most of the things that "got me" initiall

Re: Double underscores -- ugly?

2008-02-19 Thread Marco Mariani
Ben Finney wrote: >> I realise that double underscores make the language conceptually >> cleaner in many ways (because fancy syntax and operator overloading >> are just handled by methods), but they don't *look* nice. > > That's a good thing, in that it draws attention to the names. Well, double

Re: Double underscores -- ugly?

2008-02-19 Thread Duncan Booth
Berwyn <[EMAIL PROTECTED]> wrote: >> Is it just me that thinks "__init__" is rather ugly? Not to mention >> "if __name__ == '__main__': ..."? > > That ugliness has long been my biggest bugbear with python, too. The > __name__ == '__main__' thing is something I always have to look up, > every tim

Re: Double underscores -- ugly?

2008-02-18 Thread benhoyt
> [Terry Jan Reedy] > No, the reservered special names are supposed to be ugly ;-) -- or at least > to stand out. However, since special methods are almost always called > indirectly by syntax and not directly, only the class writer or reader, but > not users, generally see them. Fair enough, bu

Re: Double underscores -- ugly?

2008-02-18 Thread Raymond Hettinger
[benhoyt] > Is it just me that thinks "__init__" is rather ugly? I also find it unattractive and unpleasant to type. In Py3.0, I would support a single underscore convention, _init_ or somesuch. I'm not sure what the aesthetic reasons are, but somehow the change from double underscores to single

Re: Double underscores -- ugly?

2008-02-18 Thread Terry Reedy
"benhoyt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi guys, | | I've been using Python for some time now, and am very impressed with | its lack of red tape and its clean syntax -- both probably due to the | BDFL's ability to know when to say "no". | | Most of the things that

Re: Double underscores -- ugly?

2008-02-18 Thread Asun Friere
benhoyt wrote: > Is it just me that thinks "__init__" is rather ugly? I used to hate looking at and having the type out all those underscores (surely two leading or one on either side would do?), but I've gotten so used to it by now the eyes don't see and the fingers work by themselves. > Not to

The __name__ == '__main__' hack (was: Double underscores -- ugly?)

2008-02-18 Thread Ben Finney
benhoyt <[EMAIL PROTECTED]> writes: > Not to mention "if __name__ == '__main__': ..."? Unlike the double-underscore attribute names for signalling "special meaning", that particular hack is IMO unnecessarily ugly. I don't, however, think it's likely to go away any time soon. If that's the uglies

Re: Double underscores -- ugly?

2008-02-18 Thread Berwyn
> Is it just me that thinks "__init__" is rather ugly? Not to mention > "if __name__ == '__main__': ..."? That ugliness has long been my biggest bugbear with python, too. The __name__ == '__main__' thing is something I always have to look up, every time I use it, too ... awkward. I'd settle for:

Re: Double underscores -- ugly?

2008-02-18 Thread Ben Finney
benhoyt <[EMAIL PROTECTED]> writes: > I realise that double underscores make the language conceptually > cleaner in many ways (because fancy syntax and operator overloading > are just handled by methods), but they don't *look* nice. That's a good thing, in that it draws attention to the names. Th

Double underscores -- ugly?

2008-02-18 Thread benhoyt
Hi guys, I've been using Python for some time now, and am very impressed with its lack of red tape and its clean syntax -- both probably due to the BDFL's ability to know when to say "no". Most of the things that "got me" initially have been addressed in recent versions of Python, or are being ad