Re: A thread import problem

2012-07-22 Thread Devin Jeanpierre
On Sun, Jul 22, 2012 at 7:14 PM, Bruce Sherwood wrote: > (2) My hand is forced by Apple no longer supporting Carbon. Among > other aspects of this, Carbon can't be used with 64-bit Python, and > more and more Mac users of VPython want to use 64-bit Python. So there > has to be a version of VPython

Re: default repr?

2012-07-22 Thread Steven D'Aprano
On Mon, 23 Jul 2012 10:29:33 +1000, Chris Angelico wrote: > On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano > wrote: >>> Methods are just functions, and you can call any method of any class >>> with any object as its first parameter. >> >> Not quite: they have to be an instance of that class. >

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Dave Angel
On 07/22/2012 11:29 AM, Tony the Tiger wrote: > Hi, > Is there such a thing in the language, or do I have to invent it myself? > > I came up with the following: > > # options.modus_list contains, e.g., "[2,3,4]" > # (a string from the command line) > > > > So which is it, a list of strings, o

Re: default repr?

2012-07-22 Thread Devin Jeanpierre
On Sun, Jul 22, 2012 at 8:29 PM, Chris Angelico wrote: > On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano > wrote: >> Not quite: they have to be an instance of that class. 8< > Hmm. I would have thought that methods were like all other functions: > they take their arguments and do code w

Re: default repr?

2012-07-22 Thread Chris Angelico
On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano wrote: >> Methods are just functions, and you can call any method of any class >> with any object as its first parameter. > > Not quite: they have to be an instance of that class. > >> Though this mightn't work with everything. I wasn't able to pai

Re: default repr?

2012-07-22 Thread Steven D'Aprano
On Mon, 23 Jul 2012 08:54:00 +1000, Chris Angelico wrote: > On Mon, Jul 23, 2012 at 8:48 AM, Dan Stromberg > wrote: >> If a class has defined its own __repr__ method, is there a way of >> getting the default repr output for that class anyway? If the class, call it C, is a subclass of some other

Re: A thread import problem

2012-07-22 Thread Bruce Sherwood
On Sun, Jul 22, 2012 at 3:48 PM, Dennis Lee Bieber wrote: > On Sun, 22 Jul 2012 13:04:25 -0600, Bruce Sherwood > declaimed the following in > gmane.comp.python.general: > > >> Another way of saying this is that I'm not building an app, in which >> case I would structure things in a simple and str

Re: default repr?

2012-07-22 Thread Oscar Benjamin
On 22 July 2012 23:48, Dan Stromberg wrote: > > If a class has defined its own __repr__ method, is there a way of getting > the default repr output for that class anyway? > For new style classes you can just call object.__repr__ e.g.: In [1]: class A(object): ...: pass ...: In [2]: c

Re: default repr?

2012-07-22 Thread Chris Angelico
On Mon, Jul 23, 2012 at 8:48 AM, Dan Stromberg wrote: > If a class has defined its own __repr__ method, is there a way of getting > the default repr output for that class anyway? Methods are just functions, and you can call any method of any class with any object as its first parameter. object._

default repr?

2012-07-22 Thread Dan Stromberg
If a class has defined its own __repr__ method, is there a way of getting the default repr output for that class anyway? I'm attempting to graph some objects by digging around in the garbage collector's idea of what objects exist, and when I go to format them for the graph node labels, the ones th

Re: A thread import problem

2012-07-22 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 5:47 PM, Dennis Lee Bieber wrote: > On Sat, 21 Jul 2012 17:10:05 -0600, Bruce Sherwood > declaimed the following in > gmane.comp.python.general: > > >> Thanks, but the problem I need to solve does not permit putting a >> function like runner in the main program. I'm constr

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Jan Riechers
On 22.07.2012 20:01, Steven D'Aprano wrote: [SNIP] map is faster than an ordinary for-loop if the function you are applying is a builtin like int, str, etc. But if you have to write your own pure- Python function, the overhead of calling a function negates the advantage of map, which is no faster

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 17:18, rusi wrote: On Jul 22, 2:20 pm, Lipska the Kat wrote: Well I have to say that I've used Eclipse with the myEclipse plugin for a number of years now and although it has it's moments it has earned me LOADS of MONEY so I can't really criticise it. Ive probably tried to use ec

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Ian Kelly
On Sun, Jul 22, 2012 at 10:20 AM, Jan Riechers wrote: > Hi, > > I am not sure why everyone is using the for-iterator option over a "map", > but I would do it like that: > > MODUS_LIST= map(int, options.modus_list) > > "map" works on a list and does commandX (here "int" conversion, use "str" > for

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Jan Riechers
On 22.07.2012 20:03, David Robinow wrote: On Sun, Jul 22, 2012 at 12:20 PM, Jan Riechers wrote: On 22.07.2012 18:39, Alister wrote: looks like a classic list comprehension to me and can be achieved in a single line MODUS_LIST=[int(x) for x in options.modus_list] Hi, I am not sure why everyon

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Steven D'Aprano
On Sun, 22 Jul 2012 19:20:18 +0300, Jan Riechers wrote: > "map" works on a list and does commandX (here "int" conversion, use > "str" for string.. et cetera) on sequenceY, returning a sequence. More > in the help file. > > And if I'm not completely mistaken, it's also the quicker way to do > perf

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Paul Rubin
Tony the Tiger writes: > # options.modus_list contains, e.g., "[2,3,4]" Try this: import ast MODUS_LIST = ast.literal_eval(options.modus_list) literal_eval is like eval except it can only evaluate literals rather than calling functions and the like. The idea is you can use it on untrus

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread David Robinow
On Sun, Jul 22, 2012 at 12:20 PM, Jan Riechers wrote: > On 22.07.2012 18:39, Alister wrote: >> looks like a classic list comprehension to me and can be achieved in a >> single line >> MODUS_LIST=[int(x) for x in options.modus_list] > Hi, > > I am not sure why everyone is using the for-iterator opt

command line option parsing and pylint?

2012-07-22 Thread Dan Stromberg
Is there such a thing as a Python option parsing module, that plays well with pylint? I've been doing my own option parsing to get working static analysis. -- http://mail.python.org/mailman/listinfo/python-list

Re: My first ever Python program, comments welcome

2012-07-22 Thread rusi
On Jul 22, 2:20 pm, Lipska the Kat wrote: > Well I have to say that I've used Eclipse with the myEclipse plugin for > a number of years now and although it has it's moments it has earned me > LOADS of MONEY so I can't really criticise it. Ive probably tried to use eclipse about 4 times in the la

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Peter Otten
Tony the Tiger wrote: > On Sun, 22 Jul 2012 11:39:30 -0400, Roy Smith wrote: > >> To answer the question you asked, to convert a list of strings to a list >> of ints, you want to do something like: >> >> MODUS_LIST = [int(i) for i in options.modus_list] > > Thanks. I'll look into that. I now

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Jan Riechers
On 22.07.2012 18:39, Alister wrote: On Sun, 22 Jul 2012 10:29:44 -0500, Tony the Tiger wrote: I came up with the following: # options.modus_list contains, e.g., "[2,3,4]" # (a string from the command line) # MODUS_LIST contains, e.g., [2,4,8,16] # (i.e., a list of integers) if

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Alister
On Sun, 22 Jul 2012 10:29:44 -0500, Tony the Tiger wrote: > Hi, > Is there such a thing in the language, or do I have to invent it myself? > > I came up with the following: > > # options.modus_list contains, e.g., "[2,3,4]" > # (a string from the command line) > # MODUS_LIST contains, e.g.,

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Roy Smith
In article <3rcdnuciwpp1gzhnnz2dnuvz7vqaa...@giganews.com>, Tony the Tiger wrote: > Hi, > Is there such a thing in the language, or do I have to invent it myself? > > I came up with the following: > > # options.modus_list contains, e.g., "[2,3,4]" > # (a string from the command line) > # M

Re: Looking for good tutorials after reading "Byte of Python"

2012-07-22 Thread Lipska the Kat
On 22/07/12 15:48, Paulo wrote: My main goal is to do web development with Django/flask or another framework that suits me best. But I think that I should learn a bit more of Python before diving into a framework. I would like to know if anyone has some good tutorials like building a to-do l

Re: Sudden doubling of nearly all messages

2012-07-22 Thread Rotwang
On 21/07/2012 19:16, Rick Johnson wrote: [...] It's due to the new Google Groups interface. They started forcing everyone to use the new buggy version about a week ago EVEN THOUGH the old interface is just fine. I disagree - the old interface was dreadful and needed fixing. The new one is m

Looking for good tutorials after reading "Byte of Python"

2012-07-22 Thread Paulo
My main goal is to do web development with Django/flask or another framework that suits me best. But I think that I should learn a bit more of Python before diving into a framework. I would like to know if anyone has some good tutorials like building a to-do list app or any other type of progr

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 11:17, Chris Angelico wrote: On Sun, Jul 22, 2012 at 6:49 PM, Andrew Berg wrote: On 7/22/2012 3:37 AM, Lipska the Kat wrote: Many in the Linux world seem to use git. snip Use source control now; you'll reap the benefits later! from sudo apt-get install git to git add *.py wa

Re: My first ever Python program, comments welcome

2012-07-22 Thread David
On 22/07/2012, Lipska the Kat wrote: > On 21/07/12 21:10, Dave Angel wrote: >> >> A totally off-the-wall query. Are you using a source control system, >> such as git ? It can make you much braver about refactoring a working >> program. > > Thanks for your comments, I've taken them on board, > I'

Re: My first ever Python program, comments welcome

2012-07-22 Thread Chris Angelico
On Sun, Jul 22, 2012 at 6:49 PM, Andrew Berg wrote: > On 7/22/2012 3:37 AM, Lipska the Kat wrote: >> Many in >> the Linux world seem to use git. Seeing as I've been using Linux at home >> since the early days of slackware I suppose I'd better look into it. > There are Mercurial (aka Hg) and Bazaar

Re: Sudden doubling of nearly all messages

2012-07-22 Thread Dave Angel
On 07/22/2012 05:30 AM, Alan Ristow wrote: > On 07/21/2012 12:48 PM, Dave Angel wrote: >> Has anybody else noticed the sudden double-posting of nearly all >> messages in the python mailing list? > [snip] >> I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for >> non-digest mode. I r

Re: py2app bundling scikits-image etc.

2012-07-22 Thread Ned Deily
In article <8c0c74c9154346598227037a57d34...@gmail.com>, Nicklas Nordenmark wrote: > Hey guys, didn't know where else to post so I thought I'd give this list a > shot. I've been googling a lot but hasn't been able to find any reasonable > answers. Probably the best place to ask questions abou

Re: Sudden doubling of nearly all messages

2012-07-22 Thread Alan Ristow
On 07/21/2012 12:48 PM, Dave Angel wrote: Has anybody else noticed the sudden double-posting of nearly all messages in the python mailing list? [snip] I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for non-digest mode. I read the messages in threaded mode. I'm pretty sure it

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 03:55, rusi wrote: On Jul 22, 1:10 am, Dave Angel wrote: A totally off-the-wall query. Are you using a source control system, such as git ? It can make you much braver about refactoring a working program. Question in a similar vein: What development environment do you use? My i

Re: My first ever Python program, comments welcome

2012-07-22 Thread Andrew Berg
On 7/22/2012 3:37 AM, Lipska the Kat wrote: > Many in > the Linux world seem to use git. Seeing as I've been using Linux at home > since the early days of slackware I suppose I'd better look into it. There are Mercurial (aka Hg) and Bazaar as well for DVCS. AFAIK, git, Mercurial, and Bazaar are a

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 21/07/12 21:10, Dave Angel wrote: On 07/21/2012 03:08 PM, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python snip A totally off-the-wall query. Are y

Re: My first ever Python program, comments welcome

2012-07-22 Thread Mark Lawrence
On 22/07/2012 03:55, rusi wrote: On Jul 22, 1:10 am, Dave Angel wrote: A totally off-the-wall query. Are you using a source control system, such as git ? It can make you much braver about refactoring a working program. Question in a similar vein: What development environment do you use? My

py2app bundling scikits-image etc.

2012-07-22 Thread Nicklas Nordenmark
Hey guys, didn't know where else to post so I thought I'd give this list a shot. I've been googling a lot but hasn't been able to find any reasonable answers. I'm on a macbook running Lion trying to bundle a pretty extensive application that's using: * wxPython * numpy * scipy * reportlab I'm

Re: My first ever Python program, comments welcome

2012-07-22 Thread Peter Otten
Lipska the Kat wrote: > Greetings Pythoners > > A short while back I posted a message that described a task I had set > myself. I wanted to implement the following bash shell script in Python > > Here's the script > > sort -nr $1 | head -${2:-10} > > this script takes a filename and an optiona