Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-12-04 Thread Steven D'Aprano
On Thu, 03 Dec 2009 19:59:30 -0500, David Robinow wrote: > I've never heard of mbox. Is it written in Python? It is a file format used for storing email. Wikipedia is your friend: http://en.wikipedia.org/wiki/Mbox -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Manyfile Processing

2009-12-04 Thread user
Hey, sorry if i bother you with a beginners question but i have an issue with processing a bunch of files. They are some arithmetic lists the processing of one file is an easy task but how do i process many files? I tried reading that files in to a list and looping over the list elements but the

Re: Feature request: String-inferred names

2009-12-04 Thread Steven D'Aprano
On Fri, 04 Dec 2009 18:05:03 +1100, Ben Finney wrote: > Brad Harms writes: ... >> 1.) "Regular" attributes, ie. those that are shortcuts to items in the >> directly associated object's __dict__, > > I don't know what you mean by “shortcuts to items”. The names are looked > up in dictionaries; wh

Re: Feature request: String-inferred names

2009-12-04 Thread Brad Harms
On Fri, 04 Dec 2009 18:05:03 +1100, Ben Finney wrote: > Brad Harms writes: > >> Anyway, it looks like the docs agree with you >> (http://docs.python.org/glossary.html#term-attribute), so I'm not going >> to argue. > > That's good, because the terms are quite well established in Python > termino

Re: Manyfile Processing

2009-12-04 Thread Diez B. Roggisch
u...@domain.invalid schrieb: Hey, sorry if i bother you with a beginners question but i have an issue with processing a bunch of files. They are some arithmetic lists the processing of one file is an easy task but how do i process many files? I tried reading that files in to a list and looping

Re: Feature request: String-inferred names

2009-12-04 Thread Brad Harms
On Fri, 04 Dec 2009 09:00:42 +, Steven D'Aprano wrote: > Not all such attributes are actually found in instance.__dict__. ...I hadn't even considered __slots__ yet. Hm... > Or dynamic attributes returned by __getattr__ or __getattribute__. I'm looking for a generic term, because it's too cum

Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Alf P. Steinbach
Is this guaranteed to work in Python 3.x? >>> def foo(): pass ... >>> foo.blah = 222 >>> foo.blah 222 >>> _ Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Insane Problem

2009-12-04 Thread Victor Subervi
On Thu, Dec 3, 2009 at 7:07 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Thu, 03 Dec 2009 10:13:14 -0500, Carsten Haese wrote: > > > Victor Subervi wrote: > >> I believe I mentioned in my first post that the "print test" does print > >> the exact fields being called from

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Marco Mariani
Alf P. Steinbach wrote: Is this guaranteed to work in Python 3.x? >>> def foo(): pass >>> foo.blah = 222 >>> foo.blah 222 >>> _ I don't see why it shouldn't work. BTW, it's a function, not a "routine" -- http://mail.python.org/mailman/listinfo/python-list

Re: Manyfile Processing

2009-12-04 Thread Dan Sommers
On Fri, 04 Dec 2009 10:00:53 +0200, user wrote: > sorry if i bother you with a beginners question but i have an issue > with processing a bunch of files. They are some arithmetic lists the > processing of one file is an easy task but how do i process many files? > I tried reading that files in to

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Alf P. Steinbach
* Marco Mariani: Alf P. Steinbach wrote: Is this guaranteed to work in Python 3.x? >>> def foo(): pass >>> foo.blah = 222 >>> foo.blah 222 >>> _ I don't see why it shouldn't work. For example, (42).blah = 666 The question is what guarantees or absence thereof the language sp

Re: Which is more pythonic?

2009-12-04 Thread Bruno Desthuilliers
Filip Gruszczyński a écrit : I have just written a very small snippet of code and started thinking, which version would be more pythonic. Basically, I am adding a list of string to combo box in qt. So, the most obvious way is: for choice in self.__choices: choicesBox.addItem(choice) But

Connecting to the users preferred email client

2009-12-04 Thread Tuomas Vesterinen
If I want to open a html-page from Python code I can say: >>> import webbrowser >>> webbrowser.open('index.html') Is there a standard way to init an email in users preferred email client like Thubderbird, Evolution etc.? Tuomas Vesterinen -- http://mail.python.org/mailman/listinfo/python-list

Re: python bijection

2009-12-04 Thread M.-A. Lemburg
geremy condra wrote: > On Thu, Dec 3, 2009 at 12:57 PM, M.-A. Lemburg wrote: >> geremy condra wrote: >>> On Thu, Dec 3, 2009 at 7:04 AM, M.-A. Lemburg wrote: I think the only major CS data type missing from Python is some form of (fast) directed graph implementation à la kjGraph: >

Re: Organization of GUIs

2009-12-04 Thread denis
On Dec 3, 2:44 pm, Michael Mossey wrote: > complete VISIBILITY and control of messages ... is most important: being able to SEE messages (filtered on from, to, ...) in a running system really helps to understand it. Hierarchy does help structure messages coarse/fine, but visibility is orthogonal

Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Петров Александр
Hello All ! In my code I try to use a generic approach to work with tuples. Let "X" be a tuple. When I want to access a first element of a tuple, I can write: "X[0]". And that is really working when X is a n-arity tuple, with n>1 (for example "foo( (1,2,3) )" ). But when I call my library function

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Andre Engels
2009/12/4 Петров Александр : > Hello All ! > > In my code I try to use a generic approach to work with tuples. Let > "X" be a tuple. > When I want to access a first element of a tuple, I can write: "X[0]". > And that is really working when X is a n-arity tuple, with n>1 (for > example "foo( (1,2,3)

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Baptiste Lepilleur
By adding a before the closing brace of the tuple. Python allow this to disambiguate between braced expression and tuple >>> type( (1,) ) 2009/12/4 Петров Александр > > How could I tell Python that "(1)" is not an integer, but an one-arity > tuple ? > > Thank you, > Alexander Petrov > -- > ht

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Wolodja Wentland
On Fri, Dec 04, 2009 at 15:17 +0300, Петров Александр wrote: > In my code I try to use a generic approach to work with tuples. Let > "X" be a tuple. > When I want to access a first element of a tuple, I can write: "X[0]". > And that is really working when X is a n-arity tuple, with n>1 (for > examp

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Baptiste Lepilleur
By adding a before the closing brace of the tucomma after 1. Python allow this to disambiguate between braced expression and tuple >>> type( (1,) ) 2009/12/4 Петров Александр > > How could I tell Python that "(1)" is not an integer, but an one-arity > tuple ? > > Thank you, > Alexander Petrov

Re: Formatting logically nested actions -- Pythonic way?

2009-12-04 Thread sturlamolden
On 4 Des, 07:24, "Alf P. Steinbach" wrote: > And this leads to hierarchical code, which would be nice to indicate by > indenting, but oops, indenting in Python is syntactically significant... I've seen this with OpenGL as well. Intendation between glBegin and glEnd can be achieved with a context

logging module, SMTPHandler and gmail in python 2.6

2009-12-04 Thread mynthon
You cannot use gmail account for sending emails with logging module. It is because google requires TLS connection and logging module doesn't support it. To use gmail you have to extend logging.handlers.SMTPHandler class and override SMTPHandler.emit() method. Here is source code. (There really sho

Re: editor with autocompletion

2009-12-04 Thread Tim Chase
So I want an editor with auto complete. I there any such tool in Python ?(not only in python any other) I want it for my new lang vim? emacs? or do you want the editor to be written in Python? -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature request: String-inferred names

2009-12-04 Thread Steven D'Aprano
On Thu, 03 Dec 2009 23:12:39 -0600, Brad Harms wrote: > On Tue, 2009-12-01 at 14:38 +, Steven D'Aprano wrote: [...] >> It's just special double-underscore methods like __init__ __add__ etc >> that have to be in the class rather than the instance. (To be precise, >> you can add such a method to

Re: Manyfile Processing

2009-12-04 Thread km
use glob module Krishna On Fri, Dec 4, 2009 at 6:37 PM, Diez B. Roggisch wrote: > u...@domain.invalid schrieb: > >> Hey, >> >> sorry if i bother you with a beginners question but i have an issue >> with processing a bunch of files. They are some arithmetic lists the >> processing of one file is

Re: editor with autocompletion

2009-12-04 Thread mynthon
On 4 Gru, 13:37, Tim Chase wrote: > > So I want an editor with auto complete. > > I there any such tool in Python ?(not only in python any other) > > I want it for my new lang > > vim?  emacs?  or do you want the editor to be written in Python? > > -tkc Try ActiveState Komodo (or free version: Ko

Re: Question on Python as career

2009-12-04 Thread Michele Simionato
After 5 years of postdoc in Physics I decided to change career and to move to IT. I decided to learn Object Oriented Programming first. I chose Python since it was already installed on my Linux machine and it was easy to tackle for a beginner. In the process of learning Python I began posting to th

Re: Connecting to the users preferred email client

2009-12-04 Thread Mike Driscoll
On Dec 4, 5:28 am, Tuomas Vesterinen wrote: > If I want to open a html-page from Python code I can say: > >  >>> import webbrowser >  >>> webbrowser.open('index.html') > > Is there a standard way to init an email in users preferred email client > like Thubderbird, Evolution etc.? > > Tuomas Vester

RE: memory error

2009-12-04 Thread Ahmed, Shakir
From: python-list-bounces+shahmed=sfwmd@python.org [mailto:python-list-bounces+shahmed=sfwmd@python.org] On Behalf Of Stephen Hansen Sent: Thursday, December 03, 2009 10:22 PM To: python-list@python.org Subject: Re: memory error On Thu, Dec 3, 2009 at 5:51 AM, Ahmed, Shakir wro

Re: editor with autocompletion

2009-12-04 Thread Gerhard Häring
Siva B wrote: > Hi friends, > > I am writing a new language. > So I want an editor with auto complete. > I there any such tool in Python ?(not only in python any other) > I want it for my new lang IDLE, the Integrated Development Environment included with your Python installation nowadays has aut

Re: Manyfile Processing

2009-12-04 Thread user
On 12/04/2009 12:58 PM, Dan Sommers wrote: > On Fri, 04 Dec 2009 10:00:53 +0200, user wrote: > >> sorry if i bother you with a beginners question but i have an issue >> with processing a bunch of files. They are some arithmetic lists the >> processing of one file is an easy task but how do i proc

Re: Question on Python as career

2009-12-04 Thread joy99
On Dec 4, 6:53 pm, Michele Simionato wrote: > After 5 years of postdoc in Physics I decided to changecareerand to > move to IT. I decided to learn Object Oriented Programming first. I > chosePythonsince it was already installed on my Linux machine and it > was easy to tackle for a beginner. In the

Difference between mutex.mutex and threading.Lock

2009-12-04 Thread sven
Hi, what is the difference between mutex.mutex and threading.Lock? Neither the documentation nor a Google search gave me any clue. Another issue: The documentation of mutex in version 2.6.4 says: "Deprecated since version The: mutex module has been removed in Python 3.0." Maybe it should also s

Re: Feature request: String-inferred names

2009-12-04 Thread Bruno Desthuilliers
Brad Harms a écrit : On Tue, 2009-12-01 at 16:58 +0100, Bruno Desthuilliers wrote: The Music Guy a écrit : (snip) Lie Ryan, I think I see what you're saying about using __dict__ to add members No "members" in Python - only attributes. to a class, but it's not quite the same. __dict__ is onl

Re: Feature request: String-inferred names

2009-12-04 Thread Bruno Desthuilliers
Ben Finney a écrit : Brad Harms writes: (snip) 2.) Attributes whose values are determined or assigned dynamically by indirectly calling a function (like properties and instancemethods) Yes, the term “property” seems to do what you want. The property type is just one possible application o

Re: Feature request: String-inferred names

2009-12-04 Thread Bruno Desthuilliers
Brad Harms a écrit : On Fri, 04 Dec 2009 18:05:03 +1100, Ben Finney wrote: (snip) 2.) Attributes whose values are determined or assigned dynamically by indirectly calling a function (like properties and instancemethods) Yes, the term “property” seems to do what you want. I wasn't asking what

Re: testing command line scripts that use optparse

2009-12-04 Thread Jean-Michel Pichavant
Peter wrote: Hi I have a script like this: def doit(input, output): parser = OptionParser() parser.add_option("-a", "--accounts", dest="accounts", default="all", help="list available accounts") ... (options, args) = parser.parse_args() # main driver if __name__ == "__mai

Re: Manyfile Processing

2009-12-04 Thread Peter Otten
u...@domain.invalid wrote: > On 12/04/2009 12:58 PM, Dan Sommers wrote: > > On Fri, 04 Dec 2009 10:00:53 +0200, user wrote: > > > >> sorry if i bother you with a beginners question but i have an issue > >> with processing a bunch of files. They are some arithmetic lists the > >> processing of on

Re: Moving from Python 2 to Python 3: 4 page "cheat sheet" issue#3

2009-12-04 Thread Mark Summerfield
On 3 Dec, 01:17, Antoine Pitrou wrote: > Le Tue, 01 Dec 2009 06:03:36 -0800, Mark Summerfield a écrit : > > > I've produced a 4 page document that provides a very concise summary of > > Python 2<->3 differences plus the most commonly used new Python 3 > > features. It is aimed at existing Python 2

Killing Another Bug

2009-12-04 Thread Victor Subervi
Hi; I have this code: for table in tables: if table == 'products': optionsCode = optionsCodeProducts fromForm = prodsFromForm try: fn = getattr(options, table) fromForm = form.getfirst('%s-options' % table) fromForm = string.split(fromForm[2:-2], "', '")

Re: slightly OT: Python BootCamp

2009-12-04 Thread Neil Cerutti
On 2009-12-04, Steven D'Aprano wrote: > How would I re-write this? Just get rid of the try block and > add a close: > > for (exten, list) in files.iteritems(): > f=open('extensions-%s.txt' % exten,'w') > f.write('\n'.join(list)) "\n".join is a cute shortcut, but if you use it you must rem

Re: python bijection

2009-12-04 Thread MRAB
M.-A. Lemburg wrote: geremy condra wrote: On Thu, Dec 3, 2009 at 12:57 PM, M.-A. Lemburg wrote: geremy condra wrote: On Thu, Dec 3, 2009 at 7:04 AM, M.-A. Lemburg wrote: I think the only major CS data type missing from Python is some form of (fast) directed graph implementation à la kjGraph

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread MRAB
Andre Engels wrote: 2009/12/4 Петров Александр : Hello All ! In my code I try to use a generic approach to work with tuples. Let "X" be a tuple. When I want to access a first element of a tuple, I can write: "X[0]". And that is really working when X is a n-arity tuple, with n>1 (for example "fo

Re: Killing Another Bug

2009-12-04 Thread MRAB
Victor Subervi wrote: Hi; I have this code: [snip] As you can see in the supplied comments, when I loop through for table 'prescriptions', it only prints out the first element of each variable. When I loop through for table 'products', it prints out all of them! Why? If you're serious a

Re: More elegant solution for diffing two sequences

2009-12-04 Thread Ulrich Eckhardt
Lie Ryan wrote: > On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote: >> I'm trying to write some code to diff two fonts. What I have is every >> character (glyph) of the two fonts in a list. I know that the list is >> sorted by the codepoints of the characters. What I'd like to ask is >> whether there is

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Rami Chowdhury
>> BTW, it's a function, not a "routine" > > Wikipedia is your friend, http://en.wikipedia.org/wiki/Subroutine>. > > I don't think it was a problem of comprehension, more one of appropriate terminology -- AFAIK in Python, they're called functions, so calling them 'routines' is likely to confuse an

Re: memory error

2009-12-04 Thread Stephen Hansen
> > But-- the image does say Pythonwin... are you running this from the > Pythonwin editor/IDE? Does this script crash out if you run it through the > normal 'python'(or pythonw) commands? If not, are you attempting to do any > sort of GUI work in this script? That rarely works within Pythonwin > d

Re: Killing Another Bug

2009-12-04 Thread Victor Subervi
On Fri, Dec 4, 2009 at 12:43 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I have this code: >> >> > [snip] > > As you can see in the supplied comments, when I loop through for table >> 'prescriptions', it only prints out the first element of each variable. When >> I loop through for tabl

Re: Killing Another Bug

2009-12-04 Thread Victor Subervi
On Fri, Dec 4, 2009 at 2:08 PM, Victor Subervi wrote: > On Fri, Dec 4, 2009 at 12:43 PM, MRAB wrote: > >> Victor Subervi wrote: >> >>> Hi; >>> I have this code: >>> >>> >> [snip] >> >> As you can see in the supplied comments, when I loop through for table >>> 'prescriptions', it only prints out

Re: More elegant solution for diffing two sequences

2009-12-04 Thread Neil Cerutti
On 2009-12-04, Ulrich Eckhardt wrote: > Lie Ryan wrote: > Thinking about it, I perhaps should store the glyphs in a set > from the beginning. Question is, can I (perhaps by providing > the right hash function) sort them by their codepoint? I'll > have to look at the docs... No, sets are unordered

Re: More elegant solution for diffing two sequences

2009-12-04 Thread MRAB
Ulrich Eckhardt wrote: Lie Ryan wrote: On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote: I'm trying to write some code to diff two fonts. What I have is every character (glyph) of the two fonts in a list. I know that the list is sorted by the codepoints of the characters. What I'd like to ask is whe

How to tell if you're running on windows?

2009-12-04 Thread Roy Smith
I'm using 2.5.1. How can I tell if I'm running on windows? The obvious answer, platform.system(), gets complicated. On the python that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got a native windows build of python where it returns 'Microsoft'. The real problem I'm trying to

Re: How to tell if you're running on windows?

2009-12-04 Thread zeph
On Dec 4, 10:46 am, Roy Smith wrote: > I'm using 2.5.1. How can I tell if I'm running on windows? The > obvious answer, platform.system(), gets complicated. On the python > that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got > a native windows build of python where it returns

Re: How to tell if you're running on windows?

2009-12-04 Thread Allan Davis
Try this import sys import os sep = None if sys.platform == 'cygwin': sep = ';' else: sep = os.pathsep # then use sep in your path statment Hope this helps Thanks, -- Allan Davis Member of NetBeans Dream Team http://wiki.netbeans.or

Re: More elegant solution for diffing two sequences

2009-12-04 Thread Lie Ryan
On 12/5/2009 4:20 AM, Ulrich Eckhardt wrote: Thinking about it, I perhaps should store the glyphs in a set from the beginning. Question is, can I (perhaps by providing the right hash function) sort them by their codepoint? I'll have to look at the docs... Python does not guarantee that a partic

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Lie Ryan
On 12/5/2009 4:56 AM, Rami Chowdhury wrote: I don't think it was a problem of comprehension, more one of appropriate terminology -- AFAIK in Python, they're called functions, so calling them 'routines' is likely to confuse anyone in a discussion of Python features. Human language is not context

Re: python bijection

2009-12-04 Thread geremy condra
On Fri, Dec 4, 2009 at 2:52 PM, geremy condra wrote: > On Fri, Dec 4, 2009 at 11:17 AM, MRAB wrote: >> M.-A. Lemburg wrote: >>> >>> geremy condra wrote: On Thu, Dec 3, 2009 at 12:57 PM, M.-A. Lemburg wrote: > > geremy condra wrote: >> >> On Thu, Dec 3, 2009 at 7:04 AM,

Re: How to tell if you're running on windows?

2009-12-04 Thread Ross Ridge
Roy Smith wrote: >The real problem I'm trying to solve is whether to build a LIBPATH >environment variable with ';' or ':' delimiting the entries. On the >cygwin build, os.pathsep returns ':', which isn't really correct. If >you use that, you end up building paths that look like c:foo:c:bar. >I

Re: How to tell if you're running on windows?

2009-12-04 Thread David Robinow
On Fri, Dec 4, 2009 at 1:46 PM, Roy Smith wrote: > I'm using 2.5.1.  How can I tell if I'm running on windows?  The > obvious answer, platform.system(), gets complicated.  On the python > that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got > a native windows build of python wher

Re: Formatting logically nested actions -- Pythonic way?

2009-12-04 Thread Lie Ryan
On 12/4/2009 5:24 PM, Alf P. Steinbach wrote: Hi. I discovered with tkinter the registration of widgets with layout managers (tkinter "geometry" managers, e.g. calls to pack()) needs to be done very hierarchically. And this leads to hierarchical code, which would be nice to indicate by indentin

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 6:53 AM, geremy condra wrote: To be fair, I don't think you'd have to look very far to find places where a graph representation is approximated using some combination of dicts, sets, and lists. ElementTree comes to mind immediately, and the dict-of-dicts idea for logging recently dis

Partial list comprehensions

2009-12-04 Thread Joel Davis
Is it possible to run a list comprehension over a certain portion of the list? My goals is to be able to run the comprehension on the innermost elements of the list, but leaving the outermost intact. -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial list comprehensions

2009-12-04 Thread Stephen Hansen
> > Is it possible to run a list comprehension over a certain portion of > the list? My goals is to be able to run the comprehension on the > innermost elements of the list, but leaving the outermost intact. > Without seeing an example of what your list is, and what you want to turn it into, its s

Re: Partial list comprehensions

2009-12-04 Thread Mensanator
On Dec 4, 2:22 pm, Joel Davis wrote: > Is it possible to run a list comprehension over a certain portion of > the list? My goals is to be able to run the comprehension on the > innermost elements of the list, but leaving the outermost intact. Something like this? >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8

Re: python bijection

2009-12-04 Thread geremy condra
On Fri, Dec 4, 2009 at 3:10 PM, Lie Ryan wrote: > On 12/5/2009 6:53 AM, geremy condra wrote: >> >> To be fair, I don't think you'd have to look very far to find places >> where a graph representation is approximated using some >> combination of dicts, sets, and lists. ElementTree comes to mind >>

Re: Killing Another Bug

2009-12-04 Thread Stephen Hansen
On Fri, Dec 4, 2009 at 7:52 AM, Victor Subervi wrote: > except: > > except: > pass > If you want any hope of fixing the bug, remove both of these. Really -- do not use bare excepts. In the first one, it looks like you're expecting sometimes there to be an exception: that's okay.

Re: Which is more pythonic?

2009-12-04 Thread nn
On Dec 3, 10:41 am, Filip Gruszczyński wrote: > I have just written a very small snippet of code and started thinking, > which version would be more pythonic. Basically, I am adding a list of > string to combo box in qt. So, the most obvious way is: > > for choice in self.__choices: >         choi

Re: How to tell if you're running on windows?

2009-12-04 Thread Roy Smith
In article , David Robinow wrote: > On Fri, Dec 4, 2009 at 1:46 PM, Roy Smith wrote: > > I'm using 2.5.1.  How can I tell if I'm running on windows?  The > > obvious answer, platform.system(), gets complicated.  On the python > > that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I'v

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-04 Thread Terry Reedy
Alf P. Steinbach wrote: > The question is what guarantees or absence thereof the language specification, PEPs, intentions, whatever gives/has. The two docs backed up by PEPs. I suppose the docs could be clearer. 5.3.1 says "The primary must evaluate to an object of a type that supports attrib

Re: Insane Problem

2009-12-04 Thread Terry Reedy
Victor Subervi wrote: I'm not rude To me, asking for help without providing sufficient information, especially when requested, is a form of rudeness. Think about that and don't be rude. Exactly. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: python bijection

2009-12-04 Thread Terry Reedy
M.-A. Lemburg wrote: Integrating an easy-to-use graph library into the collections module (and it's C companion) is good idea. This would have to be written in C, though, That's currently in the works, along with database backing. We'd welcome any help though... hint, hint... The current th

Re: Killing Another Bug

2009-12-04 Thread Victor Subervi
On Fri, Dec 4, 2009 at 3:46 PM, Stephen Hansen wrote: > > On Fri, Dec 4, 2009 at 7:52 AM, Victor Subervi wrote: > >> except: >> > > >> except: >> pass >> > > If you want any hope of fixing the bug, remove both of these. Really -- do > not use bare excepts. > > In the first one, it lo

question about subprocess and shells

2009-12-04 Thread Ross Boylan
If one uses subprocess.Popen(args, ..., shell=True, ...) When args finishes execution, does the shell terminate? Either way seems problematic. If it does not terminate, then it seems as if calls like wait and communicate would never return. It also seems the subprocess would never die, and that

subprocess kill

2009-12-04 Thread luca72
Hello i'm using subprocess in this way: self.luca = subprocess.Popen(['/usr/bin/ dvbtune'+frase_sint],shell=True, stdout=self.f_s_l,stderr=self.f_s_e ) then i kill: self.luca.Kill() but the process is still active and the file self.f_s_l increase it size because the process is not killed. How i

Specifying an API for a straeming parser

2009-12-04 Thread tyler
Howdy folks, I'm working on a JSON Python module [1] and I'm struggling with an appropriate syntax for dealing with incrementally parsing streams of data as they come in (off a socket or file object). The underlying C-level parsing library that I'm using (Yajl [2]) already uses a callback system

Re: Insane Problem

2009-12-04 Thread Lie Ryan
On 12/5/2009 8:27 AM, Terry Reedy wrote: Victor Subervi wrote: I'm not rude To me, asking for help without providing sufficient information, especially when requested, is a form of rudeness. Think about that and don't be rude. Why does this sounds familiar? http://groups.google.com/group/c

Re: Partial list comprehensions

2009-12-04 Thread Joel Davis
On Dec 4, 3:41 pm, Mensanator wrote: > On Dec 4, 2:22 pm, Joel Davis wrote: > > > Is it possible to run a list comprehension over a certain portion of > > the list? My goals is to be able to run the comprehension on the > > innermost elements of the list, but leaving the outermost intact. > > Som

Re: Partial list comprehensions

2009-12-04 Thread Stephen Hansen
On Fri, Dec 4, 2009 at 2:11 PM, Joel Davis wrote: > Yes, sort of like that but Hansen's code is actually exactly what I > was getting at, not sure why he deleted it: Huh? I deleted it? --S -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between mutex.mutex and threading.Lock

2009-12-04 Thread zeph
The mutex class (and module) should not be used, since it is, as you said, deprecated for 3.0. Like the docs say, it "does not require (or imply) threading or multi-tasking, though it could be useful for those purposes." The mutex class' lock() method takes a function and args and if the mutex is

Re: subprocess kill

2009-12-04 Thread Mike Driscoll
On Dec 4, 3:50 pm, luca72 wrote: > Hello i'm using subprocess in this way: > self.luca = subprocess.Popen(['/usr/bin/ > dvbtune'+frase_sint],shell=True, stdout=self.f_s_l,stderr=self.f_s_e ) > > then i kill: > self.luca.Kill() > > but the process is still active and the file self.f_s_l increase it

Re: python bijection

2009-12-04 Thread Carl Banks
On Dec 4, 12:46 pm, geremy condra wrote: more common than full-blown graph package). > Sure, its a tree, which is also a graph. In this case it looks to > me more like a directed acyclic graph than anything, but its > pretty much just semantics since the interface is functionally > equivalent. I'

Re: question about subprocess and shells

2009-12-04 Thread Lie Ryan
On 12/5/2009 8:38 AM, Ross Boylan wrote: If one uses subprocess.Popen(args, ..., shell=True, ...) When args finishes execution, does the shell terminate? Either way seems problematic. If it does not terminate, then it seems as if calls like wait and communicate would never return. It also see

Re: Connecting to the users preferred email client

2009-12-04 Thread Tuomas Vesterinen
Mike Driscoll wrote: On Dec 4, 5:28 am, Tuomas Vesterinen wrote: If I want to open a html-page from Python code I can say: >>> import webbrowser >>> webbrowser.open('index.html') Is there a standard way to init an email in users preferred email client like Thubderbird, Evolution etc.? Tuom

Re: subprocess kill

2009-12-04 Thread luca72
On 4 Dic, 23:23, Mike Driscoll wrote: > On Dec 4, 3:50 pm, luca72 wrote: > > > Hello i'm using subprocess in this way: > > self.luca = subprocess.Popen(['/usr/bin/ > > dvbtune'+frase_sint],shell=True, stdout=self.f_s_l,stderr=self.f_s_e ) > > > then i kill: > > self.luca.Kill() > > > but the proc

Question on class module import

2009-12-04 Thread monkeyboy
Hello, I want to write a wrapper class around a windows dll. If I put the class in a module "Refprop.py" then import the class where I want to use it, does the whole module get read by the interpreter or just the class code?... For example if I say the following in "Refprop.py" does the code abov

Re: subprocess kill

2009-12-04 Thread luca72
On 5 Dic, 00:03, luca72 wrote: > On 4 Dic, 23:23, Mike Driscoll wrote: > > > > > On Dec 4, 3:50 pm, luca72 wrote: > > > > Hello i'm using subprocess in this way: > > > self.luca = subprocess.Popen(['/usr/bin/ > > > dvbtune'+frase_sint],shell=True, stdout=self.f_s_l,stderr=self.f_s_e ) > > > > th

Re: Difference between mutex.mutex and threading.Lock

2009-12-04 Thread Roy Smith
In article , zeph wrote: > The mutex class (and module) should not be used, since it is, as you > said, deprecated for 3.0. Like the docs say, it "does not require (or > imply) threading or multi-tasking, though it could be useful for those > purposes." Over the years, many things about Python

Redirecting stdin to a file

2009-12-04 Thread candide
How do I redirect stdin to a text file ? In C, this can be done with the freopen() standard function, for instance FILE *foo = freopen("in.txt", "r", stdin); redirects stdin to the in.txt text file. Does anyone know a freopen() Python equivalent ? Notice that I'm not referring to shell redirect

Re: subprocess kill

2009-12-04 Thread luca72
On 5 Dic, 00:14, luca72 wrote: > On 5 Dic, 00:03, luca72 wrote: > > > > > On 4 Dic, 23:23, Mike Driscoll wrote: > > > > On Dec 4, 3:50 pm, luca72 wrote: > > > > > Hello i'm using subprocess in this way: > > > > self.luca = subprocess.Popen(['/usr/bin/ > > > > dvbtune'+frase_sint],shell=True, st

Re: Question on class module import

2009-12-04 Thread MRAB
monkeyboy wrote: Hello, I want to write a wrapper class around a windows dll. If I put the class in a module "Refprop.py" then import the class where I want to use it, does the whole module get read by the interpreter or just the class code?... [snip] The whole module will be run. In Pytho

How to timeout when waiting for raw_input from user ?

2009-12-04 Thread northof40
Hi - I'm writing a *very* simple program for my kids. It asks the user to give it the answer to a maths question and says "right" or "wrong" They now want a timed version where they would only get so long to respond to the question. I'm thinking of some logic where a raw_input call is executed an

Re: Redirecting stdin to a file

2009-12-04 Thread MRAB
candide wrote: How do I redirect stdin to a text file ? In C, this can be done with the freopen() standard function, for instance FILE *foo = freopen("in.txt", "r", stdin); redirects stdin to the in.txt text file. Does anyone know a freopen() Python equivalent ? Notice that I'm not referring

Re: Question on class module import

2009-12-04 Thread Steven D'Aprano
On Fri, 04 Dec 2009 15:10:49 -0800, monkeyboy wrote: > Hello, > > I want to write a wrapper class around a windows dll. If I put the class > in a module "Refprop.py" then import the class where I want to use it, > does the whole module get read by the interpreter or just the class > code?... Eve

Re: How to timeout when waiting for raw_input from user ?

2009-12-04 Thread northof40
On Dec 5, 12:52 pm, northof40 wrote: > Hi - I'm writing a *very* simple program for my kids. It asks the user > to give it the answer to a maths question and says "right" or "wrong" > > They now want a timed version where they would only get so long to > respond to the question. > > I'm thinking o

Re: Redirecting stdin to a file

2009-12-04 Thread Lie Ryan
On 12/5/2009 10:31 AM, candide wrote: How do I redirect stdin to a text file ? In C, this can be done with the freopen() standard function, for instance FILE *foo = freopen("in.txt", "r", stdin); redirects stdin to the in.txt text file. Does anyone know a freopen() Python equivalent ? Notice

Re: Redirecting stdin to a file

2009-12-04 Thread candide
@MRAB @Lie Ryan Thanks, it works fine ! -- http://mail.python.org/mailman/listinfo/python-list

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 9:41 AM, Carl Banks wrote: On Dec 4, 12:46 pm, geremy condra wrote: more common than full-blown graph package). Sure, its a tree, which is also a graph. In this case it looks to me more like a directed acyclic graph than anything, but its pretty much just semantics since the interf

[distutils] Install script under a different name

2009-12-04 Thread Nikolaus Rath
Hello, All my Python files have extension .py. However, I would like to install scripts that are meant to be called by the user without the suffix, i.e. the file scripts/doit.py should end up as /usr/bin/doit. Apparently the scripts= option of the setup() function does not support this directly.

package_data question

2009-12-04 Thread Miki
Hello All, I'm trying to add package_data from outside the package directory. The current project looks like: . |-- __init__.py |-- a | `-- src | `-- py | `-- __init__.py |-- b | `-- src | `-- py | `-- __init__.py |-- c | `-- src | `-- py | `--

Re: python bijection

2009-12-04 Thread geremy condra
On Fri, Dec 4, 2009 at 5:41 PM, Carl Banks wrote: > On Dec 4, 12:46 pm, geremy condra wrote: > more common than full-blown graph package). >> Sure, its a tree, which is also a graph. In this case it looks to >> me more like a directed acyclic graph than anything, but its >> pretty much just seman

  1   2   >