[ANN] guiqwt v2.1.3

2011-05-06 Thread Pierre.RAYBAUT
Hi all, I am pleased to announce that `guiqwt` v2.1.3 has been released. Based on PyQwt (plotting widgets for PyQt4 graphical user interfaces) and on the scientific modules NumPy and SciPy, guiqwt is a Python library providing efficient 2D data-plotting features (curve/image visualization and

Wing IDE 4.0.2 released

2011-05-06 Thread Wingware
Hi, Wingware has released version 4.0.2 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call

Re: 回复: Re: BeautifulSoup import error

2011-05-06 Thread Stefan Behnel
1011_wxy, 06.05.2011 04:29: 发件人: James Mills On Fri, May 6, 2011 at 11:37 AM, 1011_wxy wrote: I got a import error when I use Python 3.2 to import BeautifulSoup 3.2.0 . Is there any differences between Python 3.2 and other version? This is my first time to use Python3.2 . And the error message

Re: 回复: Re: BeautifulSoup import error

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 3:57 PM, Stefan Behnel stefan...@behnel.de wrote: No. While this has been suggested, it will not become part of the stdlib in the foreseeable future. It's readily available as a separate package on PyPI, though. Opps I meant xml.etree :/ My bad! cheers James -- --

checking if a list is empty

2011-05-06 Thread Jabba Laci
Hi, If I want to check if a list is empty, which is the more pythonic way? li = [] (1) if len(li) == 0: ... or (2) if not li: ... Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-list Digest, Vol 92, Issue 40

2011-05-06 Thread Nico Grubert
PIL will compile and install if you don't have some development libraries and then simply not work or not work up to full steam when used. To avoid this, you need to install the appropriate libraries, among which are: libjpeg-devel freetype-devel libpng-devel Dear Albert Thank you for your

Re: checking if a list is empty

2011-05-06 Thread Chris Rebert
On Thu, May 5, 2011 at 11:36 PM, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? Option (2), IMO. li = [] (1) if len(li) == 0: ... FYI, also equivalent: if not len(li): ... or (2) if not li: Cheers, Chris --

string formatting

2011-05-06 Thread Jabba Laci
Hi, Which is the preferred way of string formatting? (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky', 'blue') As I know (1) is old style. (2) and (3) are new but (3) is only supported from Python 2.7+. Which one should be used?

Re: string formatting

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 10:00:30 +0200, Web Dreamer wrote: Jabba Laci a écrit ce vendredi 6 mai 2011 09:18 dans mailman.1229.1304666321.9059.python-l...@python.org : Hi, Which is the preferred way of string formatting? (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky',

Re: string formatting

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 1:46 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 06 May 2011 10:00:30 +0200, Web Dreamer wrote: Jabba Laci a écrit ce vendredi 6 mai 2011 09:18 dans mailman.1229.1304666321.9059.python-l...@python.org : Hi, Which is the preferred way of

seems like a bug in isinstance()

2011-05-06 Thread dmitrey
hi all, suppose I've created a class Point in file .../openopt/kernel/Point.py Consider the code in file .../somewhere/file1.py from openopt.kernel.Point import Point p = Point() now let's pass p into a func from .../openopt/kernel/file2.py and check from Point import Point isinstance(p, Point)

Re: Development tools and practices for Pythonistas

2011-05-06 Thread Jonathan Hartley
On Apr 26, 3:39 pm, snorble snor...@hotmail.com wrote: I appreciate any advice or guidance anyone has to offer. The 'Python Project HOWTO' gives good advice in terms of setting up a new project, what files and directories to create, what to put in version control, etc:

Re: seems like a bug in isinstance()

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 2:24 AM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I've created a class Point in file .../openopt/kernel/Point.py Consider the code in file .../somewhere/file1.py from openopt.kernel.Point import Point p = Point() now let's pass p into a func from

Re: Development tools and practices for Pythonistas

2011-05-06 Thread Tim Golden
On 06/05/2011 10:51, Jonathan Hartley wrote: On Apr 26, 3:39 pm, snorblesnor...@hotmail.com wrote: I appreciate any advice or guidance anyone has to offer. The 'Python Project HOWTO' gives good advice in terms of setting up a new project, what files and directories to create, what to put in

Re: Embedding Python's library as zip file

2011-05-06 Thread Wojtek Mamrak
Are you calling Py_SetProgramName? That may help to set sys.prefix and sys.exec_prefix. However, looking at site.py, it appears that it's only looking for proper directories. I don't think it will be able to add a site-packages inside a zip archive at all; you will just have to add that

Re: PIL: The _imaging C module is not installed

2011-05-06 Thread Christian Heimes
Am 06.05.2011 01:48, schrieb Michel Claveau - MVP: Re! And why the problem no exist with PIL 1.1.6? (only 1.1.7) Is that the version 1.1.6 does not use these libraries? PIL 1.1.6 also uses its internal C library to speed things up. For Windows you should use the precompiled packages.

Re: seems like a bug in isinstance()

2011-05-06 Thread dmitrey
On May 6, 12:57 pm, Chris Rebert c...@rebertia.com wrote: On Fri, May 6, 2011 at 2:24 AM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I've created a class Point in file .../openopt/kernel/Point.py Consider the code in file .../somewhere/file1.py from openopt.kernel.Point import

Re: checking if a list is empty

2011-05-06 Thread Richard Thomas
On May 6, 7:36 am, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? li = [] (1) if len(li) == 0: ... or (2) if not li: ... Thanks, Laszlo I prefer (1), it feels more explicit about what I'm testing. The fact that

if statement multiple or

2011-05-06 Thread Lutfi Oduncuoglu
Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c') not in line: print line But it does not work for. What may be the problem Thanks, Lutfi -- http://mail.python.org/mailman/listinfo/python-list

Re: if statement multiple or

2011-05-06 Thread Christian Heimes
Am 06.05.2011 12:47, schrieb Lutfi Oduncuoglu: Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c') not in line: print line But it does not work for. What may be the problem if any(s not in line for s in ('a', 'b', 'c')): #

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c') not in line: print line The expression: ('a' or 'b' or 'c') evaluates to True True not in line Is

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
Correction: ('a' or 'b' or 'c') evaluates to 'a' -- http://mail.python.org/mailman/listinfo/python-list

Re: if statement multiple or

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 4:02 AM, Albert Hopkins mar...@letterboxes.org wrote: On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c')  not in line:    print line The expression:  

Re: checking if a list is empty

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 4:36 PM, Jabba Laci jabba.l...@gmail.com wrote: If I want to check if a list is empty, which is the more pythonic way? [...] (2) if not li: This is fine. cheers James -- -- James Mills -- -- Problems are solved by method --

Re: if statement multiple or

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 8:47 PM, Lutfi Oduncuoglu lutfioduncuo...@gmail.com wrote: I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c')  not in line:    print line But it does not work for. What may be the problem You will need to (naively)

Python packaging (was Development tools and practices for Pythonistas)

2011-05-06 Thread rusi
On May 6, 2:59 pm, Tim Golden m...@timgolden.me.uk wrote: On 06/05/2011 10:51, Jonathan Hartley wrote: On Apr 26, 3:39 pm, snorblesnor...@hotmail.com  wrote: I appreciate any advice or guidance anyone has to offer. The 'Python Project HOWTO' gives good advice in terms of setting up a

Re: if statement multiple or

2011-05-06 Thread scattered
On May 6, 7:00 am, Christian Heimes li...@cheimes.de wrote: Am 06.05.2011 12:47, schrieb Lutfi Oduncuoglu: Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c')  not in line:    print line But it does not work for. What may be

Re: if statement multiple or

2011-05-06 Thread Christian Heimes
Am 06.05.2011 14:09, schrieb scattered: sets could also work if set('abc') set(line) == set(): print line Right! Sets work in this special case, because the OP just wants to search for a single char. It won't work for longer strings, though. Also I would write the test as: if

Re: BeautifulSoup import error

2011-05-06 Thread nirinA raseliarison
[1011_wxy] I got a import error when I use Python 3.2 to import BeautifulSoup 3.2.0 the error i see is a SyntaxError. Is there any differences between Python 3.2 and other version? yes. and there is a tool, 2to3, which converts Python 2.x scripts to work with 3.x. And the error message

Re: PIL: The _imaging C module is not installed

2011-05-06 Thread Wojtek Mamrak
@Michel use PIL downloaded from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/ regards 2011/5/6 Christian Heimes li...@cheimes.de: Am 06.05.2011 01:48, schrieb Michel Claveau - MVP: Re! And why the problem no exist with PIL 1.1.6?  (only 1.1.7) Is that the version 1.1.6 does not use these

Re: string formatting

2011-05-06 Thread nn
On May 6, 8:10 am, Web Dreamer webdrea...@nospam.fr wrote: Chris Rebert a écrit ce vendredi 6 mai 2011 11:23 dans mailman.1230.1304673808.9059.python-l...@python.org : I'm not them, but: Note: The formatting operations described here [involving %] are obsolete and may go away in future

Re: access to some text string in PDFs

2011-05-06 Thread Robert Pazur
Hi Chris, thanks for fast reply and all recommendations in helps me much! as you recommended me i used Pdfminer module to extract the text from pdf files and then with file.xreadlines() I allocated the lines where my keyword (factors in this case) appears. Till now i extract just the lines but

Re: What other languages use the same data model as Python?

2011-05-06 Thread Neil Cerutti
On 2011-05-05, Chris Angelico ros...@gmail.com wrote: On Fri, May 6, 2011 at 1:29 AM, Roy Smith r...@panix.com wrote: Hey, let's override operator,() and have some fun Destroying sanity, for fun and profit. I was thinking more along the lines of stuff like combining the envelope pattern (an

Re: if statement multiple or

2011-05-06 Thread scattered
On May 6, 8:25 am, Christian Heimes li...@cheimes.de wrote: Am 06.05.2011 14:09, schrieb scattered: sets could also work if set('abc') set(line) == set():      print line Right! Sets work in this special case, because the OP just wants to search for a single char. It won't work for

Re: Embedding Python's library as zip file

2011-05-06 Thread Wojtek Mamrak
I used py2exe in the past for that, see http://www.py2exe.org/index.cgi/ShippingEmbedded Thanks for the advice, py2exe seems to be a great tool. Unfortunately the application stops executing at the same place. It might be the case of PIL library, I found some entries about it on py2exe site.

Re: if statement multiple or

2011-05-06 Thread Tim Golden
On 06/05/2011 14:17, scattered wrote: On May 6, 8:25 am, Christian Heimesli...@cheimes.de wrote: Am 06.05.2011 14:09, schrieb scattered: sets could also work if set('abc') set(line) == set(): print line Right! Sets work in this special case, because the OP just wants to search

Re: PIL: The _imaging C module is not installed

2011-05-06 Thread Nico Grubert
PIL will compile and install if you don't have some development libraries and then simply not work or not work up to full steam when used. To avoid this, you need to install the appropriate libraries, among which are: libjpeg-devel freetype-devel libpng-devel Dear Albert Thank you

Re: string formatting

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 02:23:19 -0700, Chris Rebert wrote: On Fri, May 6, 2011 at 1:46 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 06 May 2011 10:00:30 +0200, Web Dreamer wrote: Jabba Laci a écrit ce vendredi 6 mai 2011 09:18 dans

Re: string formatting

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 14:10:17 +0200, Web Dreamer wrote: What I would like to know is the difference between deprecated and obsolete... Writing x*x instead of x**2 is obsolete, but it will never go away. Writing apply(func, args) instead of func(*args) is deprecated. It has gone away.

Wing IDE 4.0.2 Released

2011-05-06 Thread Wingware
Hi, Wingware has released version 4.0.2 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call

Re: Python IDE/text-editor

2011-05-06 Thread Alec Taylor
No thanks, it's shareware, doesn't included embedded python interpreter out-of-the-box, and isn't portable. On Fri, May 6, 2011 at 2:39 PM, JussiJ jus...@zeusedit.com wrote: On Apr 16, 1:20 pm, Alec Taylor alec.tayl...@gmail.com wrote: I'm looking for an IDE which offers syntax-highlighting,

Re: string formatting

2011-05-06 Thread MRAB
On 06/05/2011 08:18, Jabba Laci wrote: Hi, Which is the preferred way of string formatting? (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky', 'blue') As I know (1) is old style. (2) and (3) are new but (3) is only supported from

Re: string formatting

2011-05-06 Thread Adam Tauno Williams
On Fri, 2011-05-06 at 15:58 +0100, MRAB wrote: On 06/05/2011 08:18, Jabba Laci wrote: Which is the preferred way of string formatting? (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky', 'blue') As I know (1) is old style. (2) and

Re: string formatting

2011-05-06 Thread MRAB
On 06/05/2011 16:06, Adam Tauno Williams wrote: On Fri, 2011-05-06 at 15:58 +0100, MRAB wrote: On 06/05/2011 08:18, Jabba Laci wrote: Which is the preferred way of string formatting? (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky',

Re: Coolest Python recipe of all time

2011-05-06 Thread Steven D'Aprano
On Mon, 02 May 2011 10:33:31 -0700, Raymond Hettinger wrote: I think it is time to give some visibility to some of the instructive and very cool recipes in ActiveState's python cookbook. [...] What are your favorites? I'm not sure if favourite is the right word, but I'm amazed by this one:

Re: seems like a bug in isinstance()

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 4:20 AM, dmitrey dmitre...@gmail.com wrote: Thanks Cris, however, I had understood reason of the bug and mere informed Python developers of the bug to fix it. No you haven't. Few if any Python developers make a habit of reading this newsgroup. To actually report the

Re: Coolest Python recipe of all time

2011-05-06 Thread geremy condra
On Fri, May 6, 2011 at 9:59 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 02 May 2011 10:33:31 -0700, Raymond Hettinger wrote: I think it is time to give some visibility to some of the instructive and very cool recipes in ActiveState's python cookbook. [...] What

setuptools for 64-bit 2.7.1 on 64-bit Windows 7?

2011-05-06 Thread Dick Bridges
Hi all, Can someone provide some search terms I can use to find guidelines for installing modules for my 'stock' 64-bit r 271:86832, Nov 27, 2010 [MSC v.1500 64 bit (AMD)] on Win32. Host is 64-bit Windows 7. My goal is to install suds. Period. That's all. So far I've spent the better part

Re: PIL: The _imaging C module is not installed

2011-05-06 Thread Irmen de Jong
On 06-05-11 15:56, Nico Grubert wrote: However, running the selftest still fails: $ python selftest.py *** The _imaging C module is not installed I had this happening to me as well someday. I recall that first installing it (python setup.py install), and then rerunning selftest, solved

Re: Hello Friends

2011-05-06 Thread Alister Ware
On Thu, 05 May 2011 21:55:22 -0700, Ashraf Ali wrote: Do you need legal help.If so Please visit www.chicagopersonalinjurylawyerz.blogspot.com sorry I would only use a reputable firm (spaming a news group makes you disreputable by default) -- My NOSE is NUMB! --

Re: What other languages use the same data model as Python?

2011-05-06 Thread Chris Torek
John Nagle wrote: A reasonable compromise would be that is is treated as == on immutable objects. (Note: I have no dog in this fight, I would be happy with a changed is or with the current one -- leaky abstractions are fine with me, provided I am told *when* they may -- or sometimes may not --

Re: What other languages use the same data model as Python?

2011-05-06 Thread Chris Torek
In article GOmwp.13554$vp.9...@newsfe14.iad harrismh777 harrismh...@charter.net wrote: There may be some language somewhere that does pass-by-reference which is not implemented under the hood as pointers, but I can't think of any... 'cause like I've been saying, way down under the hood, we

Re: Coolest Python recipe of all time

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 10:59 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: As written, amb is just a brute-force solver using more magic than is good for any code, but it's fun to play with. This isn't really amb; as you said it's just a brute-force solver with some weird

Re: Hello Friends

2011-05-06 Thread John Bokma
Alister Ware alister.w...@ntlworld.com writes: On Thu, 05 May 2011 21:55:22 -0700, Ashraf Ali wrote: Do you need legal help.If so Please visit sorry I would only use a reputable firm (spaming a news group makes you disreputable by default) Does it make you disreputable? Since you just

Re: What other languages use the same data model as Python?

2011-05-06 Thread Chris Torek
In article iq1e0j02...@news2.newsguy.com I wrote, in part: Like it or not, Python has similar defined as undefined grey areas: one is not promised, for instance, whether the is operator is always True for small integers that are equal (although it is in CPython), nor when __del__ is called (if

Re: string formatting

2011-05-06 Thread harrismh777
Steven D'Aprano wrote: It's perfectly safe to continue using % formatting, if you choose. I would hope so, since its the way in most of the books, much of the doc and a majority of the code... I don't really like the old style, not because there is anything wrong with it, because

Re: What other languages use the same data model as Python?

2011-05-06 Thread harrismh777
Chris Torek wrote: with the Python-named-Monty, we have rigidly defined areas of doubt and uncertainty. These exist for good reasons: to allow different implementations. Oops, attribution error: this comes from Douglas Adams rather than Monty Python. Well, its certainly Monte-esq I like

Re: checking if a list is empty

2011-05-06 Thread Terry Reedy
On 5/6/2011 7:34 AM, James Mills wrote: On Fri, May 6, 2011 at 4:36 PM, Jabba Lacijabba.l...@gmail.com wrote: If I want to check if a list is empty, which is the more pythonic way? [...] (2) if not li: This is fine. This is the intended way. Anything in addition is extra noise and

Re: Coolest Python recipe of all time

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 12:36 PM, Ian Kelly ian.g.ke...@gmail.com wrote: This is typically implemented using continuations, and I'm not sure whether a true amb could actually be achieved in Python without adding continuations or flow-control macros to the language. I stand corrected. After

Re: string formatting

2011-05-06 Thread harrismh777
harrismh777 wrote:OP wrote: (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky', 'blue') On the other hand, consider this 3.x code snip: print(the %s is %d % ('sky', 'blue')) That formatting will throw an exception,

Python 3 dict question

2011-05-06 Thread dmitrey
hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some operation. In Python 2 I used mere key, val = myDict.items()[0] but in Python 3 myDict.items() return iterator. Of course, I could use for

Re: checking if a list is empty

2011-05-06 Thread harrismh777
Terry Reedy wrote: (2) if not li: This is fine. This is the intended way. Anything in addition is extra noise and wasted calculation. In other words, let Python do the boilerplate work for you. I agree, but I don't like it. ... if not li says nothing about what li is supposed to 'be'

Re: Python 3 dict question

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 12:40 PM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some operation. In Python 2 I used mere key, val = myDict.items()[0]

Re: string formatting

2011-05-06 Thread Neil Cerutti
On 2011-05-06, harrismh777 harrismh...@charter.net wrote: Steven D'Aprano wrote: It's perfectly safe to continue using % formatting, if you choose. I would hope so, since its the way in most of the books, much of the doc and a majority of the code... I don't really like the old style, not

Re: string formatting

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 1:39 PM, harrismh777 harrismh...@charter.net wrote: harrismh777 wrote:    OP wrote: (1) the %s is %s % ('sky', 'blue') (2) the {0} is {1}.format('sky', 'blue') (3) the {} is {}.format('sky', 'blue')   On the other hand, consider this 3.x code snip:   print(the %s

Re: Python 3 dict question

2011-05-06 Thread dmitrey
On May 6, 10:51 pm, Chris Rebert c...@rebertia.com wrote: On Fri, May 6, 2011 at 12:40 PM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some

Re: Coolest Python recipe of all time

2011-05-06 Thread Raymond Hettinger
[Steven D'Aprano]: As written, amb is just a brute-force solver using more magic than is good for any code, but it's fun to play with. With a small change in API, much of the magic isn't needed. from itertools import product def amb(func, *argument_ranges): for args in

Re: checking if a list is empty

2011-05-06 Thread Eric Snow
On Fri, May 6, 2011 at 1:31 PM, Terry Reedy tjre...@udel.edu wrote: On 5/6/2011 7:34 AM, James Mills wrote: On Fri, May 6, 2011 at 4:36 PM, Jabba Lacijabba.l...@gmail.com wrote: If I want to check if a list is empty, which is the more pythonic way? [...] (2) if not li: This is

Re: Python 3 dict question

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 1:51 PM, Chris Rebert c...@rebertia.com wrote: On Fri, May 6, 2011 at 12:40 PM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform

Re: checking if a list is empty

2011-05-06 Thread Adam Tauno Williams
On Fri, 2011-05-06 at 14:49 -0500, harrismh777 wrote: Terry Reedy wrote: (2) if not li: This is fine. This is the intended way. Anything in addition is extra noise and wasted calculation. In other words, let Python do the boilerplate work for you. I agree, but I don't like it. +1

Re: checking if a list is empty

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 1:05 PM, Adam Tauno Williams awill...@whitemice.org wrote: snip - and ignore the Pythonistas [they're nuts;  that x.count() doesn't work is amazingly stupid]. Eh? It works fine. [5, 2, 2, 1, 2].count(2) == 3. If you mean you want len(x) to be spelled x.count(), that's

Re: Python 3 dict question

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 1:57 PM, dmitrey dmitre...@gmail.com wrote: Unfortunately, it doesn't work, it turn out to be dict_items: next({1:2}.items()) Traceback (most recent call last):  File stdin, line 1, in module TypeError: dict_items object is not an iterator So call iter() on it first:

How can I print one sqlite table with UTF-8 collumn

2011-05-06 Thread Jayme Proni Filho
I have one sqlite database called aripuanaonline.db. In this database I have one table with two collumns first with autoincrement not null and other with varchar(100) not null. I got this error: Traceback (most recent call last): File C:\Documents and

Re: Python 3 dict question

2011-05-06 Thread Rob Wolfe
dmitrey dmitre...@gmail.com writes: hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some operation. In Python 2 I used mere key, val = myDict.items()[0] but in Python 3 myDict.items()

Re: string formatting

2011-05-06 Thread Terry Reedy
On 5/6/2011 3:22 PM, harrismh777 wrote: I don't really like the old style, not because there is anything wrong with it, There is in that it special cases tuples. For instance, a message function like def emsg(x): print(The following object caused a proplem: %s % x) raises TypeError: not

Re: Python 3 dict question

2011-05-06 Thread nirinA raseliarison
[dmitrey] hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some operation. In Python 2 I used mere key, val = myDict.items()[0] but in Python 3 myDict.items() return iterator. Of course,

Re: checking if a list is empty

2011-05-06 Thread scattered
On May 6, 2:36 am, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? li = [] (1) if len(li) == 0: ... or (2) if not li: ... Thanks, Laszlo is there any problem with (3) if li == []: ? Seems to work when I test it

Re: setuptools for 64-bit 2.7.1 on 64-bit Windows 7?

2011-05-06 Thread David Robinow
On Fri, May 6, 2011 at 1:43 PM, Dick Bridges dick.brid...@wdc.com wrote: Simple question: Is it true that no setuptools (or any other module installer) exists for 64-bit python 2.7.1? If there is an installer that works, what terms might I use to Google for information on how to acquire and

Dictionary Views -- good examples? [was Re: Python 3 dict question]

2011-05-06 Thread Ethan Furman
Ian Kelly wrote: On Fri, May 6, 2011 at 1:57 PM, dmitrey dmitre...@gmail.com wrote: Unfortunately, it doesn't work, it turn out to be dict_items: next({1:2}.items()) Traceback (most recent call last): File stdin, line 1, in module TypeError: dict_items object is not an iterator So call

Re: checking if a list is empty

2011-05-06 Thread Raymond Hettinger
On May 5, 11:36 pm, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? li = [] (1) if len(li) == 0: ... or (2) if not li: The Python core developers use the second form. See http://www.python.org/dev/peps/pep-0008/ for the

Re: checking if a list is empty

2011-05-06 Thread Philip Semanchuk
On May 6, 2011, at 5:57 PM, scattered wrote: On May 6, 2:36 am, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? li = [] (1) if len(li) == 0: ... or (2) if not li: ... Thanks, Laszlo is there any problem

Re: What other languages use the same data model as Python?

2011-05-06 Thread Chris Angelico
On Sat, May 7, 2011 at 5:25 AM, harrismh777 harrismh...@charter.net wrote: Chris Torek wrote: with the Python-named-Monty, we have rigidly defined areas of doubt and uncertainty.  These exist for good reasons: to allow different implementations. Oops, attribution error: this comes from

Re: checking if a list is empty

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk phi...@semanchuk.com wrote: What if it's not a list but a tuple or a numpy array? Often I just want to iterate through an element's items and I don't care if it's a list, set, etc. For instance, given this function definition -- def

Re: string formatting

2011-05-06 Thread Chris Angelico
On Sat, May 7, 2011 at 6:54 AM, Terry Reedy tjre...@udel.edu wrote: def emsg(x):  if isinstance(x,tuple):    x = (x,)  print(The following object caused a proplem: %s % x) Couldn't you just do that unconditionally? print(The following object caused a proplem: %s % (x,)) Chris Angelico --

Re: Dictionary Views -- good examples? [was Re: Python 3 dict question]

2011-05-06 Thread Ian Kelly
On Fri, May 6, 2011 at 4:49 PM, Ethan Furman et...@stoneleaf.us wrote: Ian Kelly wrote: On Fri, May 6, 2011 at 1:57 PM, dmitrey dmitre...@gmail.com wrote: Unfortunately, it doesn't work, it turn out to be dict_items: next({1:2}.items()) Traceback (most recent call last):  File stdin,

Re: checking if a list is empty

2011-05-06 Thread Jon Clements
On May 7, 12:51 am, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk phi...@semanchuk.com wrote: What if it's not a list but a tuple or a numpy array? Often I just want to iterate through an element's items and I don't care if it's a list, set, etc.

Re: checking if a list is empty

2011-05-06 Thread Chris Angelico
On Sat, May 7, 2011 at 6:05 AM, Adam Tauno Williams awill...@whitemice.org wrote: On Fri, 2011-05-06 at 14:49 -0500, harrismh777 wrote: Terry Reedy wrote: (2) if not li: This is fine. This is the intended way. Anything in addition is extra noise and wasted calculation. In other words,

PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread Даниил Рыжков
Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached, http://pastebin.com/waKytam3). I tried to run it. While the script was executed,

Re: string formatting

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 14:39:15 -0500, harrismh777 wrote: On the other hand, consider this 3.x code snip: print(the %s is %d % ('sky', 'blue')) That formatting will throw an exception, because the format construct is restricting the format entry to be a number, which 'blue'

Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread Benjamin Kaplan
On May 6, 2011 7:05 PM, Даниил Рыжков daniil...@gmail.com wrote: Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached,

Re: checking if a list is empty

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 16:05:09 -0400, Adam Tauno Williams wrote: I'd never accept code like if not x as an empty test. So much the worse for you then. The point of the if x idiom is that it is a polymorphic test which is independent of the type. It works with any non-broken object[1], no

Re: checking if a list is empty

2011-05-06 Thread Steven D'Aprano
On Fri, 06 May 2011 14:57:21 -0700, scattered wrote: is there any problem with (3) if li == []: ? Seems to work when I test it and seems to clearly test what you are trying to test. The only problem might be if in some contexts == has the semantics of checking for object identity.

Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread Даниил Рыжков
I haven't used gtk before, but is there a show method or something similar you need, to actually make the window appear? I don't know. I think self.wTree = gtk.glade.XML(self.gladefile) should do this. For example, author of this tutorial

Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread craf
On May 6, 2011 7:05 PM, Даниил Рыжков daniil...@gmail.com wrote: Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached,

Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread Даниил Рыжков
Thanks, Cristian! It works. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk Thanks again. Subscribed :) 2011/5/7 craf pyclut...@gmail.com: Hi. Try this: #!/usr/bin/env python import gtk.glade class TestPyGtk:    This is an Hello World GTK application    def __init__(self):

Testing tools classification

2011-05-06 Thread rusi
There is this nice page of testing tools taxonomy: http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy But it does not list staf: http://staf.sourceforge.net/index.php. -- http://mail.python.org/mailman/listinfo/python-list

[issue11015] Bring test.support docs up to date

2011-05-06 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Terry, I've incorporated your suggestions except the new formulation for verbosity to doctest.testmod, since it's not really clear which one is more accurate. I think it's intelligible as it is now (especially given that test.support is for

[issue11015] Bring test.support docs up to date

2011-05-06 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 2fd435ac3551 by Eli Bendersky in branch 'default': Issue #11015: bring test.support docs up to date http://hg.python.org/cpython/rev/2fd435ac3551 -- nosy: +python-dev ___ Python tracker

[issue12015] possible characters in temporary file name is too few

2011-05-06 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: - How is it an issue? is the number of combinations really important to you? - Isn't there a greater risk of collisions on a case-insensitive filesystem? -- nosy: +amaury.forgeotdarc ___

[issue12014] str.format parses replacement field incorrectly

2011-05-06 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +eric.smith, mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12014 ___ ___

  1   2   3   >