Re: No module name tests

2011-06-01 Thread Abhishek Amberkar [अभिषेक]
On Wed, Jun 1, 2011 at 11:53 AM, SONAL ... wrote: > Hey i have directory structure as > gkwebapp/gnukhata-webapp/gnukhata/tests/functional in which we have our test > files. > > When i run tests, get following error: > > Traceback (most recent call last): >   File "test_account.py", line 1, in >

Re: Updated blog post on how to use super()

2011-06-01 Thread Billy Mays
On 5/31/2011 10:44 PM, Raymond Hettinger wrote: I've tightened the wording a bit, made much better use of keyword arguments instead of kwds.pop(arg), and added a section on defensive programming (protecting a subclass from inadvertently missing an MRO requirement). Also, there is an entry on how

Re: float("nan") in set or as key

2011-06-01 Thread Jerry Hill
> On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote: > True, but why should the "non-integer number" type be floating point > rather than (say) rational? You seem to be implying that python only provides a single non-integer numeric type. That's not true. Python ships with a bunch of different n

Re: float("nan") in set or as key

2011-06-01 Thread Grant Edwards
On 2011-06-01, Chris Angelico wrote: > On Wed, Jun 1, 2011 at 12:59 PM, Carl Banks wrote: >> On Sunday, May 29, 2011 7:53:59 PM UTC-7, Chris Angelico wrote: >>> Okay, here's a question. The Python 'float' value - is it meant to be >>> "a Python representation of an IEEE double-precision floating

Re: float("nan") in set or as key

2011-06-01 Thread Grant Edwards
On 2011-06-01, Roy Smith wrote: > In article > Carl Banks wrote: > >> pretty much everyone uses IEEE format > > Is there *any* hardware in use today which supports floating point using > a format other than IEEE? Well, there are probably still some VAXes around in odd corners... -- Grant Edw

Python regexp exclude problem

2011-06-01 Thread Lutfi Oduncuoglu
Hello, I am trying to write a script for adding ip address to a list. Those ip addresses coming thorough from our edge router. I have a line in may script like if any(s not in z2 for s in('144.122.','188.38','193.140.99.2','213.161.144.166','92.45.88.242')): os.system(" echo " +z

Re: Python regexp exclude problem

2011-06-01 Thread Christian Heimes
Am 01.06.2011 16:20, schrieb Lutfi Oduncuoglu: > Hello, > > I am trying to write a script for adding ip address to a list. Those ip > addresses coming thorough from our edge router. > I have a line in may script like > > if any(s not in z2 for s > in('144.122.','188.38','193.140.99.2','213

Updated now can't scroll uparrow

2011-06-01 Thread Gnarlodious
I updated Python to 3.1.3 on Mac OSX. Now suddenly in the Interactive interpreter I get all this instead of scrolling the history: >>> ^[[A^[[A^[[A What's wrong and how to fix it? -- Gnarlie http://Gnarlodious.com -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-06-01 Thread Chris Angelico
On Wed, Jun 1, 2011 at 11:44 PM, Jerry Hill wrote: >> On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote: >> True, but why should the "non-integer number" type be floating point >> rather than (say) rational? Careful with the attributions, Carl was quoting me when he posted that :) > You seem to

Packaing configuration files

2011-06-01 Thread Miki Tebeka
Greetings, For some modules, I have .yaml file which contains configuration option next to the module itself. For example, there will be mypackage/logger.yaml next to mypackag/logger.py. What the best way to tell distutils/setuptools to package all these files? (I can write my custom function

Re: Updated blog post on how to use super()

2011-06-01 Thread Ian Kelly
On Wed, Jun 1, 2011 at 7:03 AM, Billy Mays wrote: > I read this when it was on HN the other day, but I still don't see what is > special about super().  It seems (from your post) to just be a stand in for > the super class name?  Is there something special I missed? It's not a stand-in for the su

Re: Updated blog post on how to use super()

2011-06-01 Thread Billy Mays
On 6/1/2011 12:42 PM, Ian Kelly wrote: On Wed, Jun 1, 2011 at 7:03 AM, Billy Mays wrote: I read this when it was on HN the other day, but I still don't see what is special about super(). It seems (from your post) to just be a stand in for the super class name? Is there something special I mis

how to avoid leading white spaces

2011-06-01 Thread rakesh kumar
Hi i have a file which contains data //ACCDJ EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, // UNLDSYST=&UNLDSYST,DATABAS=MBQV1D0A,TABLE='ACCDJ ' //ACCT EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, // UNLDSYST=&UNLDSYST,DATABAS=MBQV1D0A,TABLE='ACCT' //

Re: Updated now can't scroll uparrow

2011-06-01 Thread Chris Rebert
On Wed, Jun 1, 2011 at 7:37 AM, Gnarlodious wrote: > I updated Python to 3.1.3 on Mac OSX. Now suddenly in the Interactive > interpreter I get all this instead of scrolling the history: > ^[[A^[[A^[[A > > What's wrong and how to fix it? Looks like GNU readline support wasn't enabled in the b

Re: Updated blog post on how to use super()

2011-06-01 Thread Brian J Mingus
On Tue, May 31, 2011 at 8:44 PM, Raymond Hettinger wrote: > I've tightened the wording a bit, made much better use of keyword > arguments instead of kwds.pop(arg), and added a section on defensive > programming (protecting a subclass from inadvertently missing an MRO > requirement). Also, there

Re: Updated now can't scroll uparrow

2011-06-01 Thread Gnarlodious
Like so: ./configure MACOSX_DEPLOYMENT_TARGET=10.6 \ --enable-framework=/usr/local/python-3.1/frameworks \ --prefix=/usr/local/python-3.1 \ --enable-universalsdk=/ \ --with-universal-archs=intel Is there some directive to enable Readline? -- Gnarlie http://Gnarlodious.com -- http://mail.python.

Re: Updated blog post on how to use super()

2011-06-01 Thread Ian Kelly
On Wed, Jun 1, 2011 at 10:46 AM, Billy Mays wrote: > What it does is clear to me, but why is it interesting or special isn't. >  This looks like a small feature that would be useful in a handful of cases. Well, I agree with you there. The complexity introduced by super typically outweighs the be

Re: how to avoid leading white spaces

2011-06-01 Thread Chris Rebert
On Wed, Jun 1, 2011 at 12:31 AM, rakesh kumar wrote: > > Hi > > i have a file which contains data > > //ACCDJ EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, > // UNLDSYST=&UNLDSYST,DATABAS=MBQV1D0A,TABLE='ACCDJ   ' > //ACCT  EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, >

Re: Something is rotten in Denmark...

2011-06-01 Thread Terry Reedy
On 5/31/2011 8:09 PM, harrismh777 wrote: At the moment I'm only speaking about my OP and that particular list comprehension... the thing that happened (at least for me) is that the intuitive sense that each 'i' somehow becomes a part of the anonymous function (I know, not so) is built-in. There

Re: Python regexp exclude problem

2011-06-01 Thread MRAB
On 01/06/2011 15:20, Lutfi Oduncuoglu wrote: Hello, I am trying to write a script for adding ip address to a list. Those ip addresses coming thorough from our edge router. I have a line in may script like if any(s not in z2 for s in('144.122.','188.38','193.140.99.2','213.161.144.166','

Re: float("nan") in set or as key

2011-06-01 Thread OKB (not okblacke)
Carl Banks wrote: > On Tuesday, May 31, 2011 8:57:57 PM UTC-7, Chris Angelico wrote: >> On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote: >> > I think you misunderstood what I was saying. >> > >> > It's not *possible* to represent a real number abstractly in any >> > digita > l computer.  Python

Re: Thanks for all responses

2011-06-01 Thread Wolfgang Meiners
Am 31.05.11 23:56, schrieb Chris Angelico: > On Wed, Jun 1, 2011 at 5:52 AM, Wolfgang Meiners > wrote: >> Whenever i 'cross the border' of my program, i have to encode the 'list >> of bytes' to an unicode string or decode the unicode string to a 'list >> of bytes' which is meaningful to the world

feedparser hanging after I/O error

2011-06-01 Thread John Nagle
I have a program which uses "feedparser". It occasionally hangs when the network connection has been lost, and remains hung after the network connection is restored. My program calls d = feedparser.parse(self.url,etag=self.etag,modified=self.modified) If d is None, it raises an excep

Re: Updated blog post on how to use super()

2011-06-01 Thread Chris Torek
Summary: super(cls, data) in a method gets you the "next" handler for a given class "cls" and an instance "data" that has derived from that class at some point. In Python 2 you must spell out the names of the class and instance (normally "self") explicitly, while Python 3 grabs, at compile time, t

Re: float("nan") in set or as key

2011-06-01 Thread Ethan Furman
Carl Banks wrote: For instance, say you are using an implementation that uses > floating point, and you define a function that uses Newton's > method to find a square root: def square_root(N,x=None): if x is None: x = N/2 for i in range(100): x = (x + N/x)/2 return

Re: float("nan") in set or as key

2011-06-01 Thread Chris Torek
>Carl Banks wrote: >> For instance, say you are using an implementation that uses > > floating point, and you define a function that uses Newton's > > method to find a square root: >> >> def square_root(N,x=None): >> if x is None: >> x = N/2 >> for i in range(100): >> x = (

Re: Thanks for all responses

2011-06-01 Thread Chris Angelico
On Thu, Jun 2, 2011 at 3:29 AM, Wolfgang Meiners wrote: > Yes it helped a lot. One last question here: When i have free choice and > i dont know Python 2 and Python 3 very good: What would be the > recommended choice? Generally, Python 3. Unless there's something you really need in Python 2 (a mo

datetime.datetime and mysql different after python2.3

2011-06-01 Thread Tobiah
I'm grabbing two fields from a MySQLdb connection. One is a date type, and one is a time type. So I put the values in two variables and print them: import datetime date, time = get_fields() # for example print str(type(date)), str((type(time))) print str(date + time) In python 2.3.4, I get: 2

Re: datetime.datetime and mysql different after python2.3

2011-06-01 Thread Tobiah
> import datetime > date, time = get_fields() # for example > print str(type(date)), str((type(time))) > print str(date + time) News reader stripped newlines -- http://mail.python.org/mailman/listinfo/python-list

Comparison operators in Python

2011-06-01 Thread Anirudh Sivaraman
Hi I am a relative new comer to Python. I see that typing is strongly enforced in the sense you can't concatenate or add a string and an integer. However comparison between a string and an integer seems to be permitted. Is there any rationale behind this ? Anirudh -- http://mail.python.org/mailm

Re: Comparison operators in Python

2011-06-01 Thread Jussi Piitulainen
Anirudh Sivaraman writes: > I am a relative new comer to Python. I see that typing is strongly > enforced in the sense you can't concatenate or add a string and an > integer. However comparison between a string and an integer seems to > be permitted. Is there any rationale behind this ? In Python

Re: Comparison operators in Python

2011-06-01 Thread Ian Kelly
On Wed, Jun 1, 2011 at 12:50 PM, Anirudh Sivaraman wrote: > Hi > > I am a relative new comer to Python. I see that typing is strongly > enforced in the sense you can't concatenate or add a string and an > integer. However comparison between a string and an integer seems to > be permitted. Is there

Re: how to avoid leading white spaces

2011-06-01 Thread ru...@yahoo.com
On Jun 1, 11:11 am, Chris Rebert wrote: > On Wed, Jun 1, 2011 at 12:31 AM, rakesh kumar > > Hi > > > > i have a file which contains data > > > > //ACCDJ EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, > > // UNLDSYST=&UNLDSYST,DATABAS=MBQV1D0A,TABLE='ACCDJ   ' > > //ACCT 

Re: float("nan") in set or as key

2011-06-01 Thread Carl Banks
On Wednesday, June 1, 2011 10:17:54 AM UTC-7, OKB (not okblacke) wrote: > Carl Banks wrote: > > > On Tuesday, May 31, 2011 8:57:57 PM UTC-7, Chris Angelico wrote: > >> On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote: > > Python has several non-integer number types in the standard > > library. T

Re: how to avoid leading white spaces

2011-06-01 Thread Karim
On 06/01/2011 09:39 PM, ru...@yahoo.com wrote: On Jun 1, 11:11 am, Chris Rebert wrote: On Wed, Jun 1, 2011 at 12:31 AM, rakesh kumar Hi i have a file which contains data //ACCDJ EXEC DB2UNLDC,DFLID=&DFLID,PARMLIB=&PARMLIB, // UNLDSYST=&UNLDSYST,DATABAS=MBQV1D0A,TABLE='ACCDJ

Re: float("nan") in set or as key

2011-06-01 Thread Nobody
On Sun, 29 May 2011 23:31:19 +, Steven D'Aprano wrote: >> That's overstating it. There's a good argument to be made for raising an >> exception. > > If so, I've never heard it, and I cannot imagine what such a good > argument would be. Please give it. Exceptions allow you to write more nat

Re: float("nan") in set or as key

2011-06-01 Thread Carl Banks
On Wednesday, June 1, 2011 11:10:33 AM UTC-7, Ethan Furman wrote: > Carl Banks wrote: > > For instance, say you are using an implementation that uses > > floating point, and you define a function that uses Newton's > > method to find a square root: > > > > def square_root(N,x=None): > > if x

Re: Updated now can't scroll uparrow

2011-06-01 Thread Ned Deily
In article <6dc00d94-2776-47c1-8ad6-d7e608c6e...@n11g2000yqf.googlegroups.com>, Gnarlodious wrote: > Like so: > > ./configure MACOSX_DEPLOYMENT_TARGET=10.6 \ > --enable-framework=/usr/local/python-3.1/frameworks \ > --prefix=/usr/local/python-3.1 \ > --enable-universalsdk=/ \ > --with-universa

Re: float("nan") in set or as key

2011-06-01 Thread Grant Edwards
On 2011-05-29, Nobody wrote: > On Sun, 29 May 2011 10:29:28 +, Steven D'Aprano wrote: > >>> The correct answer to "nan == nan" is to raise an exception, because >>> you have asked a question for which the answer is nether True nor >>> False. >> >> Wrong. > > That's overstating it. There's a g

Re: Something is rotten in Denmark...

2011-06-01 Thread harrismh777
Terry Reedy wrote: function (I know, not so) is built-in. There is little to nothing indicating in the docs that this is not so On the contrary, the docs very explicitly say that a lambda expression is equivalent to a def statement. Allow me to clarify... I'm not speaking about whether the la

Re: Comparison operators in Python

2011-06-01 Thread harrismh777
Ian Kelly wrote: integer. However comparison between a string and an integer seems to > be permitted. Is there any rationale behind this ? It allows things like sorting of heterogeneous lists. It's generally viewed as a wart, though, and it was fixed in Python 3: Just another example (ex

Re: Something is rotten in Denmark...

2011-06-01 Thread harrismh777
harrismh777 wrote: Allow me to clarify... I'm not speaking about whether the lambda is short-hand for def, ... that part of the docs I understand well!... no problems there. Allow me to clarify a little further... the docs are misleading in that they state that the lambda can be coded (as an

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
On Tue, 31 May 2011 19:45:01 -0700, Carl Banks wrote: > On Sunday, May 29, 2011 8:59:49 PM UTC-7, Steven D'Aprano wrote: >> On Sun, 29 May 2011 17:55:22 -0700, Carl Banks wrote: >> >> > Floating point arithmetic evolved more or less on languages like >> > Fortran where things like exceptions were

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
On Wed, 01 Jun 2011 14:03:14 +, Grant Edwards wrote: > On 2011-06-01, Chris Angelico wrote: >> On Wed, Jun 1, 2011 at 12:59 PM, Carl Banks >> wrote: >>> On Sunday, May 29, 2011 7:53:59 PM UTC-7, Chris Angelico wrote: Okay, here's a question. The Python 'float' value - is it meant to be

Unshelving the data?

2011-06-01 Thread Uncle Ben
Shelving is a wonderfully simple way to get keyed access to a store of items. I'd like to maintain this cache though. Is there any way to remove a shelved key once it is hashed into the system? I could do it manually by removing the value and erasing the key in the directory list. But is there a

Re: Unshelving the data?

2011-06-01 Thread Chris Torek
In article <4433955b-7f54-400a-af08-1f58a75e7...@j31g2000yqe.googlegroups.com> Uncle Ben wrote: >Shelving is a wonderfully simple way to get keyed access to a store of >items. I'd like to maintain this cache though. > >Is there any way to remove a shelved key once it is hashed into the >system?

Re: Unshelving the data?

2011-06-01 Thread Ben Finney
Uncle Ben writes: > Or should I to go the full database route? It is not a lage > application. I would recommend you at least investigate the use of SQLite for your application. It is part of the standard library since Python 2.5 http://docs.python.org/library/sqlite3.html>. -- \ “Well

Re: datetime.datetime and mysql different after python2.3

2011-06-01 Thread Tim Roberts
Tobiah wrote: > >I'm grabbing two fields from a MySQLdb connection. >One is a date type, and one is a time type. > >So I put the values in two variables and print them: >... >In python 2.3.4, I get: > > >2010-07-06 09:20:45.00 > >Put in python2.4 and greater, I get this: > > >2010-07-06 > >So I'

Re: Something is rotten in Denmark...

2011-06-01 Thread Steven D'Aprano
On Wed, 01 Jun 2011 19:50:14 -0500, harrismh777 wrote: > harrismh777 wrote: >> Allow me to clarify... I'm not speaking about whether the lambda is >> short-hand for def, ... that part of the docs I understand well!... no >> problems there. > > Allow me to clarify a little further... the docs ar

Re: Something is rotten in Denmark...

2011-06-01 Thread Steven D'Aprano
On Wed, 01 Jun 2011 19:40:30 -0500, harrismh777 wrote: > The part that I don't see much about in the docs (some books, that is) > is that the lambda lookups occur late (the lambda is evaluated at the > time it is called). The Python docs on-line *do say* this (I found too > late) but its one quick

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
On Wed, 01 Jun 2011 13:41:15 -0700, Carl Banks wrote: > On Wednesday, June 1, 2011 11:10:33 AM UTC-7, Ethan Furman wrote: >> Carl Banks wrote: >> > For instance, say you are using an implementation that uses >> > floating point, and you define a function that uses Newton's method >> > to find a

Re: Something is rotten in Denmark...

2011-06-01 Thread Terry Reedy
On 6/1/2011 8:40 PM, harrismh777 wrote: The part that I don't see much about in the docs (some books, that is) is that the lambda lookups occur late (the lambda is evaluated at the time it is called). The Python docs on-line *do say* this (I found too late) but its one quick phrase that can be m

Re: Comparison operators in Python

2011-06-01 Thread Terry Reedy
On 6/1/2011 8:44 PM, harrismh777 wrote: Ian Kelly wrote: >> ?? wrote integer. However comparison between a string and an integer seems to be permitted. Is there any rationale behind this ? It allows things like sorting of heterogeneous lists. It's generally viewed as a wart, though, and it