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

2011-05-08 Thread Hans Georg Schaathun
On Sat, 07 May 2011 21:21:45 +1200, Gregory Ewing wrote: : You can manipulate them just fine by moving them : from one place to another: : : a = b : : You can use them to get at stuff they refer to: : : a = b.c : a[:] = b[:] Surely you can refer to the objects, but you cann

Re: PIL: The _imaging C module is not installed

2011-05-08 Thread Nico Grubert
I had this happening to me as well someday. I recall that first installing it (python setup.py install), and then rerunning selftest, solved that error. I tried that as well. Here is the summary of the install process: build/temp.linux-x86_64-2.4/libImaging/ZipEncode.o -L/usr/local/lib -L/usr/

Re: string formatting

2011-05-08 Thread alex23
harrismh777 wrote: > [...] because *any* time or *most* types > can be substituted and the 'polymorphism' of Python kicks in allowing > for that [...] The same benefit one might get from using the idiomatic 'if not list:'? ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if a list is empty

2011-05-08 Thread James Mills
On Mon, May 9, 2011 at 2:34 PM, Ian Kelly wrote: > "bool(list)" describes whether the list contains something.  "Not" > being a logical operator, it stands to reason that "not list" should > mean the same thing as "not bool(list)".  Anything else would be > surprising and pointlessly convoluted.  

Re: How to access elements in a list of lists?

2011-05-08 Thread Chris Roy-Smith
On 09/05/11 13:31, James Mills wrote: On Mon, May 9, 2011 at 1:23 PM, Chris Angelico wrote: Just learning python. I can see that I can address an individual element of a list of lists by doing something like: row = list[5] element = row[3] This is the correct approach. Here's an interactive

Re: Python IDE/text-editor

2011-05-08 Thread Mali Laurent
On Apr 16, 5:20 am, Alec Taylor wrote: > Good Afternoon, > > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). > > Here's a mockup of the app I'm looking for:http://i52.tinypic.com/2u

Re: checking if a list is empty

2011-05-08 Thread Ian Kelly
On Sun, May 8, 2011 at 9:33 PM, harrismh777 wrote: >   Why should the negation of a list imply that the list empty?  ... nor any > other abstract condition which is not well suited to 'not' ? (forget python > for a moment... then move on to my argument...) > >   What made the python development te

Re: checking if a list is empty

2011-05-08 Thread harrismh777
Steven D'Aprano wrote: Python is the new kid on the block, Nonsense. Python is 20 years old (1991), which makes it older than: Java, PHP, Ruby (1995) Javascript (1996) C# (2000) Visual Basic .Net (2001) Python is the new kid on the block. ... not chronologically perhaps, but measured

Re: checking if a list is empty

2011-05-08 Thread harrismh777
Steven D'Aprano wrote: which is irony extreme since 'not' is typically considered a logical > operator. Because "not" is typically used as a logical operator. In English, it negates a word or statement: "the cat is not on the mat" --> "the cat is on the mat" is false. Your pedantic bogu

Re: How to access elemenst in a list of lists?

2011-05-08 Thread James Mills
On Mon, May 9, 2011 at 1:23 PM, Chris Angelico wrote: >> Just learning python. >> I can see that I can address an individual element of a list of lists by >> doing something like: >> row = list[5] >> element = row[3] This is the correct approach. Here's an interactive example (tested): $ python

Re: checking if a list is empty

2011-05-08 Thread Michael Torrie
On 05/08/2011 05:36 PM, Dan Stromberg wrote: > Just what is an inductive algorithm? >From what I can remember, it's just an implementation of a proof essentially. Any algorithm that can be inductively proven can be implemented with recursion and specific base cases. In other words you program ju

Re: How to access elemenst in a list of lists?

2011-05-08 Thread Chris Angelico
On Mon, May 9, 2011 at 1:15 PM, Chris Roy-Smith wrote: > Just learning python. > I can see that I can address an individual element of a list of lists by > doing something like: > row = list[5] > element = row[3] > > But is there a way to directly address an entry in a single statement? Yep! ele

How to access elemenst in a list of lists?

2011-05-08 Thread Chris Roy-Smith
Just learning python. I can see that I can address an individual element of a list of lists by doing something like: row = list[5] element = row[3] But is there a way to directly address an entry in a single statement? Thanks for any help. Regards Chris Roy-Smith -- http://mail.python.org/mailm

Re: Development time vs. runtime performance (was: Fibonacci series recursion error)

2011-05-08 Thread Robert Brown
Teemu Likonen writes: > * 2011-05-08T12:59:02Z * Steven D'Aprano wrote: > >> On Sun, 08 May 2011 01:44:13 -0400, Robert Brown wrote: >>> Python requires me to rewrite the slow bits of my program in C to get >>> good performance. >> >> Python doesn't require you to re-write anything in C. If you w

Re: Development time vs. runtime performance (was: Fibonacci series recursion error)

2011-05-08 Thread Chris Angelico
On Mon, May 9, 2011 at 2:34 AM, Teemu Likonen wrote: > But of course "development time" is a nicely vague concept. Depending on > the argument it can include just the features of language and > implementation. Other times it could include all the available resources > such as documentation, librar

payment wholesale SHOES(UGG BOOTS, Timberland boots ,Munich www dot 51-wholesale dot com

2011-05-08 Thread qw
payment wholesale SHOES(UGG BOOTS, Timberland boots ,Munich shoes,NIKE,ADIDAS,LV,GUCCI,CHANEL,PRADA,POLO,D&G,DIOR AND SO ON) www dot 51-wholesale dot com -- http://mail.python.org/mailman/listinfo/python-list

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

2011-05-08 Thread Gregory Ewing
Steven D'Aprano wrote: Since you haven't explained what you think is happening, I can only guess. Let me save you from guessing. I'm thinking of a piece of paper with a little box on it and the name 'a' written beside it. There is an arrow from that box to a bigger box.

Re: checking if a list is empty

2011-05-08 Thread Dan Stromberg
On Sun, May 8, 2011 at 3:41 PM, Terry Reedy wrote: > On 5/8/2011 10:07 AM, Steven D'Aprano wrote: > > Because the test of "is this nothing, or something?" is a common, useful >> test: >> > > Because inductive algorithms commonly branch on 'input is something' (not > done, change args toward 'not

Re: scipy

2011-05-08 Thread Terry Reedy
On 5/8/2011 6:44 AM, pb wrote: Hi, I', having trouble with scipy. If you do not get an answer here, try the scipy list where scipy experts hang out. You might also try searching the archives of that list or the scipy bug tracker. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinf

Re: checking if a list is empty

2011-05-08 Thread Terry Reedy
On 5/8/2011 10:07 AM, Steven D'Aprano wrote: Because the test of "is this nothing, or something?" is a common, useful test: Because inductive algorithms commonly branch on 'input is something' (not done, change args toward 'nothing'and recurse or iterate) versus 'input is nothing (done, retu

Re: dictionary size changed during iteration

2011-05-08 Thread Paul Rubin
Hans Mulder writes: > How about: > changes = filter(is_bad, d) > Or would that be too compact? I thought of writing something like that but filter in python 3 creates an iterator that would have the same issue of walking the dictionary while the dictionary is mutating. changes = list(f

Re: dictionary size changed during iteration

2011-05-08 Thread Hans Mulder
On 08/05/2011 00:12, Roy Smith wrote: In article<7xd3jukyn9@ruckus.brouhaha.com>, Paul Rubin wrote: Roy Smith writes: changes = [ ] for key in d.iterkeys(): if is_bad(key): changes.append(key) changes = list(k for k in d if is_bad(k)) is a little bit more direct. This

Re: Re: Dictionary from String?

2011-05-08 Thread gslindstrom
On May 8, 2011 2:00pm, Dan Stromberg wrote: On Sun, May 8, 2011 at 8:20 AM, Greg Lindstrom gslindst...@gmail.com> wrote: Is it possible to create a dictionary from a string value? Something along these lines (but that works): >>> mystring = "{'name':'greg','hatsize':'7 5/8'}" >>> mystri

Re: Dictionary from String?

2011-05-08 Thread Dan Stromberg
On Sun, May 8, 2011 at 8:20 AM, Greg Lindstrom wrote: > Is it possible to create a dictionary from a string value? Something along > these lines (but that works): > > >>> mystring = "{'name':'greg','hatsize':'7 5/8'}" > >>> mystring > "{'name':'greg','hatsize':'7 5/8'}" > >>> dict(mystring) > Tra

Re: Dictionary from String?

2011-05-08 Thread Benjamin Kaplan
On Sun, May 8, 2011 at 8:20 AM, Greg Lindstrom wrote: > Is it possible to create a dictionary from a string value?  Something along > these lines (but that works): > mystring = "{'name':'greg','hatsize':'7 5/8'}" mystring > "{'name':'greg','hatsize':'7 5/8'}" dict(mystring) > Traceb

Development time vs. runtime performance (was: Fibonacci series recursion error)

2011-05-08 Thread Teemu Likonen
* 2011-05-08T12:59:02Z * Steven D'Aprano wrote: > On Sun, 08 May 2011 01:44:13 -0400, Robert Brown wrote: >> I don't understand why you place Lisp and Forth in the same category >> as Pascal, C, and Java. Lisp and Forth generally have highly >> interactive development environments, while the other

Re: Dictionary from String?

2011-05-08 Thread Chris Angelico
On Mon, May 9, 2011 at 1:20 AM, Greg Lindstrom wrote: > Is it possible to create a dictionary from a string value?  Something along > these lines (but that works): > mystring = "{'name':'greg','hatsize':'7 5/8'}" mystring > "{'name':'greg','hatsize':'7 5/8'}" dict(mystring) > Traceb

Re: checking if a list is empty

2011-05-08 Thread Jussi Piitulainen
Steven D'Aprano writes: > Lisp uses the empty list and the special atom NIL as false values, > any other s-expression is true. Scheme is different: it defines a > special false atom, and empty lists are considered true. In Ruby, I'll inject a pedantic note: there is only one false value in both L

Dictionary from String?

2011-05-08 Thread Greg Lindstrom
Is it possible to create a dictionary from a string value? Something along these lines (but that works): >>> mystring = "{'name':'greg','hatsize':'7 5/8'}" >>> mystring "{'name':'greg','hatsize':'7 5/8'}" >>> dict(mystring) Traceback (most recent call last): File "", line 1, in ValueError: dic

Re: checking if a list is empty

2011-05-08 Thread Steven D'Aprano
On Sat, 07 May 2011 22:50:55 -0500, harrismh777 wrote: > Steven D'Aprano wrote: >>> > and implies in any case that li does not exist >> It does nothing of the sort. If li doesn't exist, you get a NameError. > > That was the point. 'not' implies something that is not logical; I'm afraid

Re: Development tools and practices for Pythonistas

2011-05-08 Thread Roy Smith
In article <58a6bb1b-a98e-4c4a-86ea-09e040cb2...@r35g2000prj.googlegroups.com>, snorble wrote: > [standard tale of chaotic software development elided] > > I am aware of tools like version control systems, bug trackers, and > things like these, but I'm not really sure if I need them, or how to

Re: Pushing for Pythoncard 1.0

2011-05-08 Thread rdsteph
On May 3, 12:15 pm, rnd wrote: > On May 2, 10:48 pm, John Henry wrote: > > > Attempt to push Pythoncard to a 1.0 status is now underway.  A > > temporary website has been created at: > > >http://code.google.com/p/pythoncard-1-0/ > > > The official website continues to behttp://pythoncard.sourcefo

Re: Fibonacci series recursion error

2011-05-08 Thread Steven D'Aprano
On Sun, 08 May 2011 01:44:13 -0400, Robert Brown wrote: > Steven D'Aprano writes: >> If you value runtime efficiency over development time, sure. There are >> plenty of languages which have made that decision: Pascal, C, Java, >> Lisp, Forth, and many more. > > I don't understand why you place L

Re: A suggestion for an easy logger

2011-05-08 Thread Vinay Sajip
On May 8, 12:21 pm, TheSaint wrote: > First I didn't espect to see much more than my message. I agree that I'm > very new to the module You could do logging.basicConfig(level=logging.DEBUG, format='%(message)s') to get just the message. > Second the will terminator appear only to real stdout

Re: Python IDE/text-editor

2011-05-08 Thread Matty Sarro
Pydev for eclipse/aptana On Saturday, May 7, 2011, emato wrote: > >> On Apr 16, 1:20 pm, Alec Taylor wrote: >> >>> I'm looking for an IDE which offers syntax-highlighting, >>> code-completion, tabs, > > gedit > > http://projects.gnome.org/gedit/index.html > > > -- > http://mail.python.org/mailma

Re: A suggestion for an easy logger

2011-05-08 Thread TheSaint
Vinay Sajip wrote: 8< > For Python 3.2 and later, it's the terminator attribute of the > StreamHandler. See: 8< > Unfortunately, for earlier Python versions, you'd need to subclass and > override StreamHandler.emit() to get equivalent functionality :-( > I'm with 3.2 and willing to stay :) I was

scipy

2011-05-08 Thread pb
Hi, I', having trouble with scipy. I have followed the instructions at scipy website and have installed the following on my mac osx 10.6.6 NumPy version 1.5.1 NumPy is installed in /Library/Frameworks/Python.framework/Versions/ 2.6/lib/python2.6/site-packages/numpy SciPy version 0.8.0 SciPy is in

Re: A suggestion for an easy logger

2011-05-08 Thread Vinay Sajip
On May 8, 7:15 am, TheSaint wrote: > OK, my analysis led me to the print() function, which would suffice for > initial my purposes. The logging HOWTO tells you when to use logging, warnings and print(): http://docs.python.org/howto/logging.html > Meanwhile I reading the tutorials, but I couldn

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

2011-05-08 Thread Thomas Rachel
Am 07.05.2011 11:09, schrieb Gregory Ewing: Ethan Furman wrote: Ian Kelly wrote: next(iter(myDict.items())) Which is becoming less elegant. If you're doing this sort of thing a lot you can make a little helper function: def first(x): return next(iter(x)) then you get to say first(myDict

Re: ABC-registered Exceptions are not caught as subclasses

2011-05-08 Thread andrew cooke
http://bugs.python.org/issue12029 -- http://mail.python.org/mailman/listinfo/python-list

Re: Development tools and practices for Pythonistas

2011-05-08 Thread rusi
On Apr 26, 7:39 pm, snorble wrote: > I'm not a Pythonista, but I aspire to be. > > My current tools: > > Python, gvim, OS file system > > My current practices: > > When I write a Python app, I have several unorganized scripts in a > directory (usually with several named test1.py, test2.py, etc., f