Re: Suggested coding style

2011-09-25 Thread Chris Angelico
On Mon, Sep 26, 2011 at 12:59 PM, Tim Johnson wrote: > BTW: If you like ranting as a spectator sport, I have found the >  Common Lisp newsgroup to be among the most spectacular. But that's >  just me. > I do, actually, but I don't need to add another newsgroup. Rick provides plenty of material he

Re: Suggested coding style

2011-09-25 Thread Tim Johnson
* Chris Angelico [110925 13:50]: > On Mon, Sep 26, 2011 at 4:54 AM, Petite Abeille > wrote: > > > > On Sep 25, 2011, at 8:46 PM, Tim Johnson wrote: > > > >>  Why does it suck? And why do people say 'suck' so much, especially in > >> technical venues? :) > > > > It's a technical term: > > > > htt

Re: Suggested coding style

2011-09-25 Thread Tim Johnson
* Devin Jeanpierre [110925 16:37]: > > Why does it suck? > > The gist of what I was saying is that it's possible to define > functions that do this "generically" so that one implementation of > zfill can work with multiple implementations of strings. That is kind of 'spot on' for me. Before

Re: Suggested coding style

2011-09-25 Thread Chris Angelico
On Mon, Sep 26, 2011 at 10:23 AM, Devin Jeanpierre wrote: >> Also, because technical people are opinionated windbags. > > Pardon? No offense intended; just look at this list and you'll see how opinionated people can be, and how willing to express those opinions in many words! Frank and courteous

Re: Suggested coding style

2011-09-25 Thread Devin Jeanpierre
> I would have thought that a better solution would be to specify a > minimal set of methods in an abstract superclass and write the > additional methods using that minimal set. > > The concrete string implementations would be descended from the > superclass and would still be able to override the

Re: Generating equally-spaced floats with least rounding error

2011-09-25 Thread Terry Reedy
On 9/25/2011 3:36 AM, Arnaud Delobelle wrote: On 24 September 2011 23:10, Terry Reedy wrote: The best you can do for this example is ['%20.18f' % (i/10 ) for i in range(0, 22, 3)] ['0.00', '0.299989', '0.599978', '0.900022', '1.199

Re: Suggested coding style

2011-09-25 Thread MRAB
On 26/09/2011 01:23, Devin Jeanpierre wrote: Why does it suck? The gist of what I was saying is that it's possible to define functions that do this "generically" so that one implementation of zfill can work with multiple implementations of strings. Having to reimplement every time when one im

Re: Suggested coding style

2011-09-25 Thread Devin Jeanpierre
> Why does it suck? The gist of what I was saying is that it's possible to define functions that do this "generically" so that one implementation of zfill can work with multiple implementations of strings. Having to reimplement every time when one implementation would do is bothersome and general

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
Oh the creative juices are flowing now!!! class Path: def __init__(self, path): def __coerce__(self) => File or Dir # # Properties about the path: drive => str directory => str filename => str extension => str ##uncshare[1]=> ??? # # Mutations. def

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
Here is a *very* rough outline of my ideas. There are probably a few mistakes in there. I've decided on three main main objects. A File object, a Path object, and a Dir object. ## START ENLIGHTENMENT ## class Path: def __init__(self, path): # # Properties about the path: drive =>

Re: Suggested coding style

2011-09-25 Thread Arnaud Delobelle
On Sep 25, 2011 10:49 PM, "Chris Angelico" wrote: > And if you're willing to learn, it's not uncommon to start off > complaining and end up appreciating. :) +1 QOTW -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is the shutil module called shutil?

2011-09-25 Thread Devin Jeanpierre
> Well specifically we should have a look over the Ruby API's of "File", > "Dir", and "IO". I don't believe we should copy them verbatim --as the > Ruby API is not Pythonic-- however, it may be a good starting point > for something that has been decades overdue within this community. Perhaps you w

Re: Suggested coding style

2011-09-25 Thread Chris Angelico
On Mon, Sep 26, 2011 at 4:54 AM, Petite Abeille wrote: > > On Sep 25, 2011, at 8:46 PM, Tim Johnson wrote: > >>  Why does it suck? And why do people say 'suck' so much, especially in >> technical venues? :) > > It's a technical term: > > http://www.osnews.com/images/comics/wtfm.jpg Also, because

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
On Sep 24, 11:56 pm, Matt Joiner wrote: > Please continue Well specifically we should have a look over the Ruby API's of "File", "Dir", and "IO". I don't believe we should copy them verbatim --as the Ruby API is not Pythonic-- however, it may be a good starting point for something that has been d

Re: Suggested coding style

2011-09-25 Thread Petite Abeille
On Sep 25, 2011, at 8:46 PM, Tim Johnson wrote: > Why does it suck? And why do people say 'suck' so much, especially in > technical venues? :) It's a technical term: http://www.osnews.com/images/comics/wtfm.jpg -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggested coding style

2011-09-25 Thread Tim Johnson
* Devin Jeanpierre [110924 19:07]: > > Padding numbers with leading zeroes is very common. I'm surprised that > > more languages don't make it a string method. > > By making it a string method, instead of a function, we force all > implementations of strings to implement that method. That sort of

Re: Inexplicable Urllib2 problem between virtualenv's when POSTing to a Tomcat server

2011-09-25 Thread Timmy O'Mahony
Good point. The two machines that the code works with are running python 2.6.1 and 2.7.2 and are running on my Mac (Snow Leopard) The two non-working machines are running python 2.6.6 and 2.7.1 and are on Debian 6 and Debian 5 respectively. They are VPSs managed by different providers. All of

Re: Inexplicable Urllib2 problem between virtualenv's when POSTing to a Tomcat server

2011-09-25 Thread Devin Jeanpierre
It might help to give more information about the machines. In particular, what versions of Python are on the production machines? Devin On Sun, Sep 25, 2011 at 8:31 AM, Timmy O'Mahony wrote: > Hey, I have a question on Stackoverflow at the moment that I thought I would > put up here as it might

Inexplicable Urllib2 problem between virtualenv's when POSTing to a Tomcat server

2011-09-25 Thread Timmy O'Mahony
Hey, I have a question on Stackoverflow at the moment that I thought I would put up here as it might get some more eyes (It has a bounty so feel free to answer there if you have a SO account!) I have some test code (as a part of a webapp) that uses urllib2 to perform an operation I would

Re: Generating equally-spaced floats with least rounding error

2011-09-25 Thread Steven D'Aprano
Terry Reedy wrote: > I do hope you did not stop with my lead-in sentence, and read to the > end, where I gave you most of the answer you were looking for, without > using the fractions module. Yes, I read your entire post, thank you, and for my purposes I'm happy with the fractions module. --

Re: Generating equally-spaced floats with least rounding error

2011-09-25 Thread Arnaud Delobelle
On 24 September 2011 23:10, Terry Reedy wrote: > On 9/24/2011 10:18 AM, Arnaud Delobelle wrote: >>      ((n-i)*a + i*b)/n for i in range(n+1) > ['%20.18f' % x for x in [((7-i)*0.0 + i*2.1)/7 for i in range(8)]] > ['0.00', '0.299989', '0.599978', > '0.9