[ANN] RedNotebook 0.9

2009-12-18 Thread Jendrik Seipp
Version 0.9 of RedNotebook has just been released. You can get it at http://rednotebook.sourceforge.net What is RedNotebook? RedNotebook is a graphical *diary and journal* helping you keep track of notes and thoughts. It includes a calendar navigation, customizable

[ANNOUNCE] PyGobject 2.21.0 - unstable

2009-12-18 Thread Gian Mario Tagliaretti
I am pleased to announce version 2.21.0 of the Python bindings for GObject. The new release is available from ftp.gnome.org as and its mirrors as soon as its synced correctly: http://download.gnome.org/sources/pygobject/2.21/ What's new since PyGObject 2.20.0? - pygmainloop: fix

[ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Sylvain Thénault
Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community release, including the work we've done during the pylint bug day [1] and patches mostly from James Lingard and

wrap exe with in another exe

2009-12-18 Thread prakash jp
Hi all, I need to call an external executable from my calling_exe.py python program. Can we make a executable say-Final.exe from the calling_exe.py and the external.exe *calling_exe.py -(calling)- external.exe ||

Re: share dictionary between processes

2009-12-18 Thread garabik-news-2005-05
blumenkraft vohs...@gmail.com wrote: Hi, I want to share dictionary between two distinct processes. ... I have looked at POSH, but it requires master process that will fork childs. I want read-only sharing between completely unrelated processes. Is it possible? Depends on your exact

Re: share dictionary between processes

2009-12-18 Thread Michele Simionato
On Dec 18, 8:48 am, blumenkraft vohs...@gmail.com wrote: Hi, I want to share dictionary between two distinct processes. Something like this: first.py import magic_share_module def create_dictionary():     return {a: 1} magic_share_module.share(shared_dictionary,

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread casevh
On Dec 17, 11:14 am, Joachim Dahl dahl.joac...@gmail.com wrote: In the Ubuntu 9.10 version of Python 3.1 (using your patch), there's a related bug: foo(b='b') will set the value of a in the extension module to zero, thus clearing whatever default value it may have had.  In other words,

Re: share dictionary between processes

2009-12-18 Thread News123
Hi Michael, I'm new to the module multiprocessing, but at a first glance it seems, that multiprocessing.Value can only be shared if you create the second process from the first one. Id like to start the first process from the command line and much later the second process from the command line.

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread Carlos Grohmann
Have you tried this with    dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList] Yes that is better! many thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: webscrapping ringcentral.com using mechanize

2009-12-18 Thread r0g
shrini wrote: Hi, I am trying to scrap the website 'http://service.ringcentral.com' It has a form with three input boxes. When trying to get the form with mechanize, it is throwing the following error. mechanize._mechanize.FormNotFoundError: no form matching name 'login' but, the

Fwd: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread Emeka
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) { int a=65, b=66; char *kwlist[] = {a, b, NULL}; I am yet to understand what kwlist pointer does and why it is needed? if (!PyArg_ParseTupleAndKeywords(args, kwrds, |CC, kwlist, a, b)) return NULL; return

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread Emeka
char *kwlist[] = {a, b, NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwrds, |CC, kwlist, a, b)) I am yet to understand what pointer kwlist[] does and why it is needed? Regards, Emeka On Fri, Dec 18, 2009 at 8:17 AM, casevh cas...@gmail.com wrote: On Dec 17, 11:14 am, Joachim Dahl

Webpy and UnicodeDecodeError

2009-12-18 Thread Oscar Del Ben
So I'm trying to send a file through webpy and urllib2 but I can't get around these UnicodeErrors. Here's the code: # controller x = web.input(video_original={}) params = {'foo': x['foo']} files = (('video[original]', 'test', x['video_original'].file.read ()),) client.upload(upload_url, params,

Re: ANN: withrestart 0.2.1

2009-12-18 Thread Neal Becker
I haven't tried it, but it sounds really cool. I suppose I should expect a lot more overhead compared to try/except, since it's not built-in to python? -- http://mail.python.org/mailman/listinfo/python-list

[ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Sylvain Thénault
Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community release, including the work we've done during the pylint bug day [1] and patches mostly from James Lingard and

Re: ftplib timeout in Python 2.4

2009-12-18 Thread Nico Grubert
Try the timelimited function from this recipe http://code.activestate.com/recipes/576780/ Works perfect! Thanks a lot, Jean! -- http://mail.python.org/mailman/listinfo/python-list

Re: share dictionary between processes

2009-12-18 Thread r0g
blumenkraft wrote: Hi, I want to share dictionary between two distinct processes. Something like this: first.py import magic_share_module def create_dictionary(): return {a: 1} magic_share_module.share(shared_dictionary, creator.create_dictionary) while True: pass

Re: share dictionary between processes

2009-12-18 Thread Wolodja Wentland
On Thu, Dec 17, 2009 at 23:48 -0800, blumenkraft wrote: I want to share dictionary between two distinct processes. Something like this: first.py import magic_share_module def create_dictionary(): return {a: 1} magic_share_module.share(shared_dictionary, creator.create_dictionary)

Java-to-Python?

2009-12-18 Thread Virgil Stokes
I have a rather large Java package for the analysis of networks that I would like to convert to Python. Many of the classes in the Java package are Serializable. Any recommendations on Java-to-Python (2.6) would be appreciated. --V -- http://mail.python.org/mailman/listinfo/python-list

Re: Seek support for new slice syntax PEP.

2009-12-18 Thread Colin W.
On 17-Dec-09 20:00 PM, Nobody wrote: On Mon, 14 Dec 2009 14:18:49 -0500, Terry Reedy wrote: Many more people uses range objects (xrange in 2.x). A range object has the same info as a slice object *plus* it is iterable. This isn't quite true, as a range cannot have a stop value of None, i.e.

Re: Seek support for new slice syntax PEP.

2009-12-18 Thread Colin W.
On 17-Dec-09 20:00 PM, Nobody wrote: On Mon, 14 Dec 2009 14:18:49 -0500, Terry Reedy wrote: Many more people uses range objects (xrange in 2.x). A range object has the same info as a slice object *plus* it is iterable. This isn't quite true, as a range cannot have a stop value of None, i.e.

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread Case Vanhorsen
On Fri, Dec 18, 2009 at 2:26 AM, Emeka emekami...@gmail.com wrote:    char *kwlist[] = {a, b, NULL};    if (!PyArg_ParseTupleAndKeywords(args, kwrds, |CC, kwlist, a, b)) I am yet to understand what pointer kwlist[] does and why it is needed? Regards, Emeka foo is designed to accept two

Help with invoking standard mail app in windows

2009-12-18 Thread Astan Chee
Hi, I'm trying to launch standard mail app in windows and after looking around most look like this: import urllib, webbrowser, win32api def mailto_url(to=None,subject=None,body=None,cc=None): encodes the content as a mailto link as described on http://www.faqs.org/rfcs/rfc2368.html

Eclipse Carriage Return Workaround

2009-12-18 Thread Steve Holden
I've written a Python 3 course that uses an Eclipse-based teaching system. The school is telling me that their version of Eclipse/pydev appears to have an input() function that appends a carriage return character to the user's input. This makes several things go screwy, as it's definitely not the

Line indexing in Python

2009-12-18 Thread seafoid
Hi Guys, When python reads in a file, can lines be referred to via an index? Example: for line in file: if line[0] == '0': a.write(line) This works, however, I am unsure if line[0] refers only to the first line or the first character in all lines. Is there an easy way to refer

Re: Webpy and UnicodeDecodeError

2009-12-18 Thread Dave Angel
Oscar Del Ben wrote: So I'm trying to send a file through webpy and urllib2 but I can't get around these UnicodeErrors. Here's the code: # controller x = web.input(video_original={}) params = {'foo': x['foo']} files = (('video[original]', 'test', x['video_original'].file.read ()),)

Setting Parameters inside of code

2009-12-18 Thread Jim Valenza
Hello All - I have a very novice question for any of you out there. I need to assign several parameters to a code in python. I have an example of a code that was in DOS that I would need to set as parameters in my Python script. SetLocal EnableDelayedExpansion SET OUTPUT=..\log SET LOG=..\log

Re: Java-to-Python?

2009-12-18 Thread Tim Wintle
On Fri, 2009-12-18 at 15:44 +0100, Virgil Stokes wrote: I have a rather large Java package for the analysis of networks that I would like to convert to Python. Many of the classes in the Java package are Serializable. Any recommendations on Java-to-Python (2.6) would be appreciated. I

Re: Line indexing in Python

2009-12-18 Thread Richard Thomas
On Dec 18, 3:42 pm, seafoid fitzp...@tcd.ie wrote: Hi Guys, When python reads in a file, can lines be referred to via an index? Example: for line in file:      if line[0] == '0':          a.write(line) This works, however, I am unsure if line[0] refers only to the first line or the

Re: Webpy and UnicodeDecodeError

2009-12-18 Thread Oscar Del Ben
On Dec 18, 4:43 pm, Dave Angel da...@ieee.org wrote: Oscar Del Ben wrote: So I'm trying to send a file through webpy and urllib2 but I can't get around these UnicodeErrors. Here's the code: # controller x = web.input(video_original={}) params = {'foo': x['foo']} files =

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread Emeka
Case, Thanks so much! However, I am still confused. This is what I understood; foo (a = a, b = b) so function , foo, has default values which are a and b. pointer kwlist[] is a way of specifying default values . Regards, Emeka On Fri, Dec 18, 2009 at 3:02 PM, Case Vanhorsen cas...@gmail.com

Re: Line indexing in Python

2009-12-18 Thread Steve Holden
seafoid wrote: Hi Guys, When python reads in a file, can lines be referred to via an index? Example: for line in file: if line[0] == '0': a.write(line) This works, however, I am unsure if line[0] refers only to the first line or the first character in all lines.

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread Case Vanhorsen
On Fri, Dec 18, 2009 at 7:57 AM, Emeka emekami...@gmail.com wrote: Case, Thanks so much! However, I am still confused. This is what I understood; foo (a = a, b = b) so function , foo,  has default values which are a and b. pointer kwlist[] is a way of specifying default values . Regards,

Re: Line indexing in Python

2009-12-18 Thread seafoid
Thanks for that Richard and Steve. I have another question. fname = raw_input('Please enter the name of the file: ') # create file objects blah = open(fname, 'r') a = open('rubbish', 'w') for line in blah: if line.startswith(0): a.write(line) elif line.endswith(0):

Re: Java-to-Python?

2009-12-18 Thread Luis M . González
On Dec 18, 11:44 am, Virgil Stokes v...@it.uu.se wrote: I have a rather large Java package for the analysis of networks that I would like to convert to Python. Many of the classes in the Java package are Serializable. Any recommendations on Java-to-Python (2.6) would be appreciated. --V

Re: Line indexing in Python

2009-12-18 Thread seafoid
Thanks for that Richard and Steve! Below is my full code so far: for line in file: if line.startswith(1): a.write(line) elif line.endswith(0): lists_a = line.strip().split() print lists_a elif line.startswith(2): lists_b = line.strip().split()

Design question about pretree classifier

2009-12-18 Thread Julian
Hello, I've got a design problem for a classifier. To make it short: it maps strings on strings. Some strings have exactly one classification, some none and some more than one. There's a method classify(self, word) wich classifies a word. For the first case there's no problem: - one

Re: imports in __init__.py

2009-12-18 Thread sKeeZe
I wrote my last message late last night. When I said I am unable to import a module from the package without an import error., I did mean the 'modulename' module. However, I just set up a Debian VM with Python 2.5.2 and what I was trying to do works. So it is either something that changed with

Re: imports in __init__.py

2009-12-18 Thread Phil
I wrote my last message late last night. When I said I am unable to import a module from the package without an import error., I did mean the 'modulename' module. However, I just set up a Debian VM with Python 2.5.2 and what I was trying to do works. So it is either something that changed with

Re: Line indexing in Python

2009-12-18 Thread Lie Ryan
On 12/19/2009 3:27 AM, seafoid wrote: Thanks for that Richard and Steve. I have another question. What's the question? fname = raw_input('Please enter the name of the file: ') # create file objects blah = open(fname, 'r') a = open('rubbish', 'w') for line in blah: if

Re: iterators and views of lists

2009-12-18 Thread Anh Hai Trinh
On Dec 18, 3:07 am, Brendan Miller catph...@catphive.net wrote: Well, it doesn't really need to be any slower than a normal list. You only need to use index and do extra additions because it's in python. However, if listagent were written in C, you would just have a pointer into the contents

Re: Raw string substitution problem

2009-12-18 Thread Sion Arrowsmith
Gregory Ewing greg.ew...@canterbury.ac.nz wrote: MRAB wrote: Regular expressions and replacement strings have their own escaping mechanism, which also uses backslashes. This seems like a misfeature to me. It makes sense for a regular expression to give special meanings to backslash sequences,

Re: Raw string substitution problem

2009-12-18 Thread MRAB
Gregory Ewing wrote: MRAB wrote: Regular expressions and replacement strings have their own escaping mechanism, which also uses backslashes. This seems like a misfeature to me. It makes sense for a regular expression to give special meanings to backslash sequences, because it's a sublanguage

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Jean-Michel Pichavant
Sylvain Thénault wrote: Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community release, including the work we've done during the pylint bug day [1] and patches mostly

Re: share dictionary between processes

2009-12-18 Thread Steve Holden
blumenkraft wrote: Hi, I want to share dictionary between two distinct processes. Something like this: first.py import magic_share_module def create_dictionary(): return {a: 1} magic_share_module.share(shared_dictionary, creator.create_dictionary) while True: pass

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Jerry Hill
On Fri, Dec 18, 2009 at 12:24 PM, Jean-Michel Pichavant  File /opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/infutils.py, line 28, in module   from logilab.astng._nodes import Proxy_, List, Tuple, Function, If, TryExcept ImportError: No module named

Re: Line indexing in Python

2009-12-18 Thread seafoid
Thanks for that Lie. I had to have a think about what you meant when you referred to control going to a.write(line). Have you any suggestions how I may render this code undead or should I scrap it and create something new? My confusion and ineptitude is perhaps explained by my being a

Re: imports in __init__.py

2009-12-18 Thread Peter Otten
Phil wrote: I wrote my last message late last night. When I said I am unable to import a module from the package without an import error., I did mean the 'modulename' module. However, I just set up a Debian VM with Python 2.5.2 and what I was trying to do works. So it is either something

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Jean-Michel Pichavant
Jerry Hill wrote: On Fri, Dec 18, 2009 at 12:24 PM, Jean-Michel Pichavant File /opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/infutils.py, line 28, in module from logilab.astng._nodes import Proxy_, List, Tuple, Function, If, TryExcept ImportError:

Help with invoking standard mail app in windows

2009-12-18 Thread Astan Chee
Hi, I don't know if my last mail made it or not but here it is again. I'm trying to launch standard mail app in windows and after looking around most look like this: import urllib, webbrowser, win32api def mailto_url(to=None,subject=None,body=None,cc=None): encodes the content as a

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Sylvain Thénault
On 18 décembre 18:24, Jean-Michel Pichavant wrote: Sylvain Thénault wrote: Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community release, including the work

Re: Raw string substitution problem

2009-12-18 Thread Alan G Isaac
On 12/17/2009 7:59 PM, Rhodri James wrote: re.compile('a\\nc') passes a sequence of four characters to re.compile: 'a', '\', 'n' and 'c'. re.compile() then does it's own interpretation: 'a' passes through as is, '\' flags an escape which combined with 'n' produces the newline character (0x0a),

Re: Raw string substitution problem

2009-12-18 Thread Alan G Isaac
On 12/18/2009 12:17 PM, MRAB wrote: In simple cases you might be replacing with the same string every time, but other cases you might want the replacement to contain substrings captured by the regex. Of course that conversion is needed in the replacement. But e.g. Vim substitutions handle

Re: Design question about pretree classifier

2009-12-18 Thread Steve Holden
Julian wrote: Hello, I've got a design problem for a classifier. To make it short: it maps strings on strings. Some strings have exactly one classification, some none and some more than one. There's a method classify(self, word) wich classifies a word. For the first case there's no

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread David Robinow
On Fri, Dec 18, 2009 at 12:49 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Jerry Hill wrote: On Fri, Dec 18, 2009 at 12:24 PM, Jean-Michel Pichavant  File /opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/infutils.py, line 28, in module  from

Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
I finally finished (draft), I believe!, chapter 2... Chapter 1 gets the reader up running, i.e. it's Hello, world!, basic tool usage, without discussing anything about programming really. One reaction to this chapter, based on the two example programs in it, was that it wasn't gradual and

Re: Another MySQL Problem

2009-12-18 Thread John Nagle
MRAB wrote: Victor Subervi wrote: Hi; mysql truncate tem126072414516; Query OK, 0 rows affected (0.00 sec) Then I run a script: if whatDo == 'insert': try: sql = 'insert into %s (ProdID, Quantity) values (%s, %s);' % (tmpTable, prodid, quantity) print sql

Re: Line indexing in Python

2009-12-18 Thread Lie Ryan
On 12/19/2009 4:33 AM, seafoid wrote: Thanks for that Lie. I had to have a think about what you meant when you referred to control going to a.write(line). and if-elif-elif-... chain is executed sequentially and when a match is found, the rest of the chain is skipped. Your code: if

Re: Line indexing in Python

2009-12-18 Thread seafoid
Hi Guys, It has been point out that it is difficult for anyone to provide suggestions if I do not outline more clearly my input file and an example of what I wish to do with it (Thanks Rory!). I mentioned it in this thread (Is creating different threads bad etiquette? If so, lesson learned!):

Using PyImport_ExtendInittab with package

2009-12-18 Thread Julien Danjou
Hi, I'm trying to embed Python and therefore use PyImport_ExtendInittab() to register modules. My current problem is that, if it works well with a simple module hello, naming a module hello.foobar in the inittab struct does not seems to work. imp.find_module(hello.foobar) returns correctly that

Re: Raw string substitution problem

2009-12-18 Thread Lie Ryan
On 12/19/2009 4:59 AM, Alan G Isaac wrote: On 12/18/2009 12:17 PM, MRAB wrote: In simple cases you might be replacing with the same string every time, but other cases you might want the replacement to contain substrings captured by the regex. Of course that conversion is needed in the

Re: How to create a docstring for a module?

2009-12-18 Thread Albert van der Horst
In article d95cc38a-70bf-44d5-b5d2-f9248c16c...@15g2000prz.googlegroups.com, alex23 wuwe...@gmail.com wrote: Phillip M. Feldman pfeld...@verizon.net wrote: It does seem as though IPython could be a bit more clever about this. =A0 I disagree. I _like_ that IPython is only reporting on the

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:37, Carlos Grohmann carlos.grohm...@gmail.com wrote: Tenting the time spent by each approach (using time.clock()), with a file with about 100,000 entries, I get 0.03s for the loop and 0.05s for the listcomp. thoughts? Anything else being equal, list comprehensions will be the

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:42, Alf P. Steinbach al...@start.no wrote: Have you tried this with    dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList] And for comparison with map: map(lambda dp: dp - 0.01 if dp == 90 else dp, dipList) -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread Carl Banks
On Dec 17, 9:37 am, Carlos Grohmann carlos.grohm...@gmail.com wrote: Tenting the time spent by each approach (using time.clock()), with a file with about 100,000 entries, I get 0.03s for the loop and 0.05s for the listcomp. thoughts? You shouldn't trust your intuition in things like this.

How Do I...?

2009-12-18 Thread Victor Subervi
Hi; I have this code: i = 0 nameNos = [] nos = [] for option in ourOptions(): nameNos.append('optionNo%d' % i) nos.append(i) i += 1 The idea is that through every iteration of option, I can create a new variable such as 'optionNo0', 'optionNo1' etc and assign

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread sturlamolden
On 17 Des, 18:37, Carlos Grohmann carlos.grohm...@gmail.com wrote: Tenting the time spent by each approach (using time.clock()), with a file with about 100,000 entries, I get 0.03s for the loop and 0.05s for the listcomp. thoughts? Let me ask a retoric question: - How much do you really

Re: subprocess.Popen and ordering writes to stdout and stderr

2009-12-18 Thread Lie Ryan
On 12/18/2009 8:15 AM, Chris Withers wrote: the order of the writes isn't preserved. How can I get this to be the case? You'll need to flush the std{out|err} or set them unbuffered; or you can just forget about relying on std{out|err} being ordered per write-order. --

Re: iterators and views of lists

2009-12-18 Thread Alf P. Steinbach
* Carl Banks: On Dec 17, 10:00 pm, Brendan Miller catph...@catphive.net wrote: On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote: I was thinking it would be cool to make python more usable in

Re: Help with invoking standard mail app in windows

2009-12-18 Thread Kev Dwyer
On Sat, 19 Dec 2009 04:56:34 +1100, Astan Chee wrote: Hi, I don't know if my last mail made it or not but here it is again. I'm trying to launch standard mail app in windows and after looking around most look like this: import urllib, webbrowser, win32api def

Creating Classes

2009-12-18 Thread seafoid
Hey Guys, I have started to read over classes as a brief respite from my parsing problem. When a class is defined, how does the class access the data upon which the class should act? Example: class Seq: def __init__(self,

Re: iterators and views of lists

2009-12-18 Thread Lie Ryan
On 12/18/2009 7:07 AM, Brendan Miller wrote: As for copying pointers not taking much time... that depends on how long the list is. if you are working with small sets of data, you can do almost anything and it will be efficient. However, if you have megabytes or gigabytes of data (say you are

Re: Design question about pretree classifier

2009-12-18 Thread Julian
On 18 Dez., 18:59, Steve Holden st...@holdenweb.com wrote: Julian wrote: Hello, I've got a design problem for a classifier. To make it short: it maps strings on strings. Some strings have exactly one classification, some none and some more than one. There's a method classify(self,

Re: iterators and views of lists

2009-12-18 Thread Carl Banks
On Dec 18, 11:08 am, Alf P. Steinbach al...@start.no wrote: * Carl Banks: On Dec 17, 10:00 pm, Brendan Miller catph...@catphive.net wrote: On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller

Re: Help with invoking standard mail app in windows

2009-12-18 Thread Astan Chee
Kev Dwyer wrote: Hello Astan, Your code executes without error for me on Win98 (!) with Python 2.5 or XP with Python 2.6. It would help people to help you if you could provide the *exact* console output from when you try to execute the code, *including* the traceback. That way we can

Re: How Do I...?

2009-12-18 Thread Rami Chowdhury
On Fri, Dec 18, 2009 at 10:55, Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code:     i = 0     nameNos = []     nos = []     for option in ourOptions():   nameNos.append('optionNo%d' % i)   nos.append(i)   i += 1 The idea is that through every iteration of

Re: How Do I...?

2009-12-18 Thread Victor Subervi
On Fri, Dec 18, 2009 at 3:46 PM, Rami Chowdhury rami.chowdh...@gmail.comwrote: On Fri, Dec 18, 2009 at 10:55, Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code: i = 0 nameNos = [] nos = [] for option in ourOptions():

Re: How Do I...?

2009-12-18 Thread Tim Chase
Victor Subervi wrote: How do I...? Well, you start by reading a book on how to program. You would then learn that what you want (in all likelihood) is a dictionary/map structure for dynamically created key/value pairs. Once you have progressed from your current apprenticeship and achieved

Re: Help with invoking standard mail app in windows

2009-12-18 Thread Kev Dwyer
On Sat, 19 Dec 2009 06:36:32 +1100, Astan Chee wrote: Kev Dwyer wrote: Hello Astan, Your code executes without error for me on Win98 (!) with Python 2.5 or XP with Python 2.6. It would help people to help you if you could provide the *exact* console output from when you try to execute the

Re: iterators and views of lists

2009-12-18 Thread Alf P. Steinbach
* Carl Banks: On Dec 18, 11:08 am, Alf P. Steinbach al...@start.no wrote: * Carl Banks: On Dec 17, 10:00 pm, Brendan Miller catph...@catphive.net wrote: On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 17 Dec 2009 12:07:59 -0800, Brendan

Re: shouldn't list comprehension be faster than for loops?

2009-12-18 Thread Brian J Mingus
On Fri, Dec 18, 2009 at 11:55 AM, sturlamolden sturlamol...@yahoo.nowrote: On 17 Des, 18:37, Carlos Grohmann carlos.grohm...@gmail.com wrote: Tenting the time spent by each approach (using time.clock()), with a file with about 100,000 entries, I get 0.03s for the loop and 0.05s for the

Re: Creating Classes

2009-12-18 Thread Steve Holden
seafoid wrote: Hey Guys, I have started to read over classes as a brief respite from my parsing problem. When a class is defined, how does the class access the data upon which the class should act? Example: class Seq:

Re: iterators and views of lists

2009-12-18 Thread Brendan Miller
On Fri, Dec 18, 2009 at 10:39 AM, Carl Banks pavlovevide...@gmail.com wrote: On Dec 17, 10:00 pm, Brendan Miller catph...@catphive.net wrote: On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote:

Re: Creating Classes

2009-12-18 Thread seafoid
Steve, that has indeed clarified matters! Thanks! -- View this message in context: http://old.nabble.com/Creating-Classes-tp26848375p26849864.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list

Re: Line indexing in Python

2009-12-18 Thread Rory Campbell-Lange
On 18/12/09, seafoid (fitzp...@tcd.ie) wrote: http://old.nabble.com/Parsing-file-format-to-ensure-file-meets-criteria-to26837682.html Your specification is confusing. However I suggest you break it down the code so that the steps in your programme are logical. Good luck. # example psuedocode

Re: Line indexing in Python

2009-12-18 Thread seafoid
Hey folks, Is it possible to assign a list within a nested list to a variable? Example: l = [['1', '2', '3'], ['4', '5', '6']] for i in l: if i[0][1] == '1': m = i Indeed, I generally do not understand how to assign variables within a loop! Is there an easy way to 'flatten' a

Re: Line indexing in Python

2009-12-18 Thread seafoid
Rory, You are a gentleman! Thank you very much for your suggestion! Kind Regards, Seafoid. Rory Campbell-Lange wrote: On 18/12/09, seafoid (fitzp...@tcd.ie) wrote: http://old.nabble.com/Parsing-file-format-to-ensure-file-meets-criteria-to26837682.html Your specification is confusing.

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread casevh
On Dec 18, 10:28 am, Joachim Dahl dahl.joac...@gmail.com wrote: My mistake seems to be that I declared char a, b; instead of int a, b; Thank you for sorting this out. Joachim I think you need to initialize them, too. -- http://mail.python.org/mailman/listinfo/python-list

Re: iterators and views of lists

2009-12-18 Thread Terry Reedy
On 12/18/2009 1:00 AM, Brendan Miller wrote: For the benefit of those of us who aren't C++ programmers, what do its iterators do that Python's don't? It depends on what one means by 'iterator'. Python iterators do not fit in the STL hierarchy. On the other hand, Python indexes are a form of

Re: Setting Parameters inside of code

2009-12-18 Thread Terry Reedy
On 12/18/2009 10:46 AM, Jim Valenza wrote: Hello All - I have a very novice question for any of you out there. I need to assign several parameters to a code in python. In Python, a 'parameter' is a function local name defined in the header of the function and bound to an argument when the

Re: Setting Parameters inside of code

2009-12-18 Thread David Robinow
On Fri, Dec 18, 2009 at 10:46 AM, Jim Valenza jim.vale...@gmail.com wrote: Hello All - I have a very novice question for any of you out there.  I need to assign several parameters to a code in python. I have an example of a code that was in DOS that I would need to set as parameters in my

Sort the values of a dict

2009-12-18 Thread mattia
Hi all, I have a dictionary that uses dates and a tuples ad key, value pairs. I need to sort the values of the dict and insert everything in a tuple. The additional problem is that I need to sort the values looking at the i-th element of the list. I'm not that good at python (v3.1), but this

Re: Sort the values of a dict

2009-12-18 Thread Chris Kaynor
I'd write it as: s = sorted(d.iteritems(), key=lambda i: i[1][2]) If using python 3, it should be d.items() instead of d.iteritems(). d.iteritems() is a generator yielding tuples of (key, value) from the dictionary 'd'. lambda i: i[1][2] is the same as: def sort_(i): return i[1][2] but

Re: Sort the values of a dict

2009-12-18 Thread mattia
Actually, in order to use duplicate values I need something like: import copy d = {1:('a', 1, 12), 5:('r', 21, 10), 2:('u', 9, 8), 3:('u', 9, 8) } dc = copy.deepcopy(d) t = [x for x in d.values()] def third(mls): ... return mls[2] ... s = sorted(t, key=third) pres = [] for x in s: ...

Re: iterators and views of lists

2009-12-18 Thread Bearophile
Brendan Miller: I agree though, it doesn't matter to everyone and anyone. The reason I was interested was because i was trying to solve some specific problems in an elegant way. I was thinking it would be cool to make python more usable in programming competitions by giving it its own port of

Re: Sort the values of a dict

2009-12-18 Thread David Robinow
On Fri, Dec 18, 2009 at 5:34 PM, mattia ger...@gmail.com wrote: Hi all, I have a dictionary that uses dates and a tuples ad key, value pairs. I need to sort the values of the dict and insert everything in a tuple. The additional problem is that I need to sort the values looking at the i-th

Re: Sort the values of a dict

2009-12-18 Thread mattia
Il Fri, 18 Dec 2009 18:00:42 -0500, David Robinow ha scritto: On Fri, Dec 18, 2009 at 5:34 PM, mattia ger...@gmail.com wrote: Hi all, I have a dictionary that uses dates and a tuples ad key, value pairs. I need to sort the values of the dict and insert everything in a tuple. The additional

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Mensanator
The second deviation is that since most names are constants, Really? Does that mean you don't use literals, to save the time required to convert them to integers? Isn't that done at compile time? So, instead of doing the Collatz Conjecture as while a1: f = gmpy.scan1(a,0) if f0: a = a

Acceesing python httplib2 over a network share in windows 7

2009-12-18 Thread aj
I am trying to run python from a network share on windows 7. The network share is T: t:\python-2.6.1\python Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import httplib2

Re: Sort the values of a dict

2009-12-18 Thread Rory Campbell-Lange
On 18/12/09, mattia (ger...@gmail.com) wrote: Hi all, I have a dictionary that uses dates and a tuples ad key, value pairs. I need to sort the values of the dict and insert everything in a tuple. The additional problem is that I need to sort the values looking at the i-th element of the

  1   2   3   >