Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Steven D'Aprano
On Sat, 08 Mar 2008 22:24:36 -0800, Kay Schluehr wrote: > On 9 Mrz., 06:30, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: > >> Hard Exceptions: terminate the program unless explicitly silenced Soft >> Exceptions: pass silently unless explicitly caught >> >> In this case, I agree

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Lie
On Mar 9, 12:05 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 9 Mrz., 04:51, Lie <[EMAIL PROTECTED]> wrote: > > > A more through implementation would start from the raiser inspecting > > the execution stack and finding whether there are any try block above > > it, if no try block exist it pass s

Trac - Does it make sense to keep http://trac.edgewall.org/ticket/4315 open?

2008-03-09 Thread Ilias Lazaridis
Response to message [1] on trac.devel (as I cannot write there, due to an informally applied censorship) Mr. Boos: "I left that ticket open simply to avoid having someone to reopen it over and over..." (note to reader: this someone is me) Mr. Boos, the ticket status should reflect reality. So, i

Re: Regarding coding style

2008-03-09 Thread Lie
On Mar 9, 3:27 am, [EMAIL PROTECTED] wrote: > To Lie: > > > Personally I preferred a code that has chosen good names but have > > little or no comments compared to codes that makes bad names and have > > Personally I don't.  Show me a good one.  Until you do, it's not that > I won't like it, it's t

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Kay Schluehr
On 9 Mrz., 09:30, Lie <[EMAIL PROTECTED]> wrote: > On Mar 9, 12:05 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > On 9 Mrz., 04:51, Lie <[EMAIL PROTECTED]> wrote: > > > > A more through implementation would start from the raiser inspecting > > > the execution stack and finding whether there are

gc question

2008-03-09 Thread vpalexander
I keep seeing destructor calls in wx for ad hoc dialogs and wonder if this is required, and if so, why would normal gc flow not be good? def GetDir(self,Caption,DefaultDir): dlg = wx.DirDialog(None,Caption,style = 1,defaultPath = DefaultDir,pos = (10,10)) res = dlg.ShowModal() pck =

Re: gc question

2008-03-09 Thread Vince
On Mar 9, 1:51 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 09 Mar 2008 01:42:01 -0800, vpalexander wrote: > > I keep seeing destructor calls in wx for ad hoc dialogs and wonder if > > this is required, and if so, why would normal gc flow not be good? > > Because there is no gu

Re: gc question

2008-03-09 Thread Marc 'BlackJack' Rintsch
On Sun, 09 Mar 2008 01:42:01 -0800, vpalexander wrote: > I keep seeing destructor calls in wx for ad hoc dialogs and wonder if > this is required, and if so, why would normal gc flow not be good? Because there is no guarantee when `__del__()` is called or if it is called *at all*. Ciao,

Re: Arbitrary precision integer arithmetic: ceiling?

2008-03-09 Thread Alasdair
Thanks, all - you've been most helpful. By the way, what does // do? I haven't yet run down its definition in the manual. -A. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help xxx.py Program Recognition problem

2008-03-09 Thread Vince
On Mar 8, 9:48 am, [EMAIL PROTECTED] wrote: > Hi... > > I was using Python 2.4 and installed 2.5...I copied all my .py files > from the Python24\ root directory to the Python25\ root > directory...when I try to run them by double clicking I get: > "X.py is not a valid Win32 application"... > >

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Mel
Lie wrote: [ ... ] > Soft Exception > What is "Soft Exception"? > Soft Exception is an exception that if is unhandled, pass silently as > if nothing happened. For example, if a variable turns into NoneType, > it'll raise Soft Exception that it have become NoneException, > programmers that wants to

Re: Green's Function

2008-03-09 Thread ericofam
On Mar 8, 9:46 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "olusina eric" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |  I am new to Python and trying to solve the Hamiltonian of a linear chair > of atoms using green's function. > |  Does anyone know any pre-existing librar

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Bryan Olson
Lie wrote: [...] > Soft Exception is an exception that if is unhandled, pass silently as > if nothing happened. [...] > Implementation: > Simple implementation might be done by catching all exceptions at the > highest level, then filtering which exceptions would be stopped (Soft > Exception) and w

The intel processor reach the very high place...

2008-03-09 Thread sadreti
The intel processor reach the very high place... http://intelsprocessor.googlepages.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Arbitrary precision integer arithmetic: ceiling?

2008-03-09 Thread Steven D'Aprano
On Sun, 09 Mar 2008 20:57:15 +1100, Alasdair wrote: > Thanks, all - you've been most helpful. By the way, what does // do? I > haven't yet run down its definition in the manual. // is integer division. >>> 10//5 2 >>> 11//5 2 In Python 2.5 and older, / means integer division, unless you do

Re: Checking if a variable is a dictionary

2008-03-09 Thread Guillermo
>A protocol is just an interface that an object agrees to implement. In >your case, you would state that every object stored in your special >dict must implement the to_tagged_value method with certain agreeable >semantics. Hm... I've searched about the implementation of protocols and now (I beli

Re: parralel downloads

2008-03-09 Thread John Deas
On Mar 8, 5:47 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > poof65 wrote: > > For your problem you have to use threads. > > Not at all true. Thread provide one way to solve this, but another is > the select function. For this simple case, select() may (or may not) be > easier to write. Pseudo-co

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Lie
On Mar 9, 6:57 pm, Bryan Olson <[EMAIL PROTECTED]> wrote: > Lie wrote: > > [...]> Soft Exception is an exception that if is unhandled, pass silently as > > if nothing happened. > > [...] > > > Implementation: > > Simple implementation might be done by catching all exceptions at the > > highest leve

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Lie
On Mar 9, 4:31 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 9 Mrz., 09:30, Lie <[EMAIL PROTECTED]> wrote: > > On Mar 9, 12:05 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 9 Mrz., 04:51, Lie <[EMAIL PROTECTED]> wrote: > > > > > A more through implementation would start from the raiser

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Steven D'Aprano
On Sun, 09 Mar 2008 00:30:51 -0800, Lie wrote: > (3) Informing codes above it about what's currently happening inside, > the thing is just a mundane report that might be useful to codes above > > Which might be a useful place to use SoftExceptions Okay, now we're getting somewhere. So, I have a

Re: parralel downloads

2008-03-09 Thread John Deas
On Mar 9, 1:25 pm, John Deas <[EMAIL PROTECTED]> wrote: > On Mar 8, 5:47 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > > > > > poof65 wrote: > > > For your problem you have to use threads. > > > Not at all true. Thread provide one way to solve this, but another is > > the select function. For this

Re: Checking if a variable is a dictionary

2008-03-09 Thread Steven D'Aprano
On Sun, 09 Mar 2008 05:20:41 -0700, Guillermo wrote: >>A protocol is just an interface that an object agrees to implement. In >>your case, you would state that every object stored in your special dict >>must implement the to_tagged_value method with certain agreeable >>semantics. > > Hm... I've s

Re: identifying and parsing string in text file

2008-03-09 Thread [EMAIL PROTECTED]
On 8 mar, 20:49, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a large file that has many lines like this, > > name="DoseReferenceStructureType">SITE > > I would like to identify the line by the tag (300a,0014) and then grab > the name (DoseReferenceStructureType) and value (SITE). It's

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Diez B. Roggisch
Lie schrieb: > I'm asking about people in c.l.py's opinion about a _probably_ very > Pythonic way of doing something if such features is implemented. It is > to be known that I'm not a Python expert and actually relatively new > to Python programming, so probably I'm just not thinking pythonic > en

Uninstalling Eggs

2008-03-09 Thread PB
I just installed the Shove module with the monumentally crap setuptools. Whilst the install succeeded, imports now trigger errors, so clearly it did not install correctly. Can I simply delete the .egg file from my lib/python2.3/site-packages/ directory? Cheers, -- http://mail.python.org/mailman/l

Re: Checking if a variable is a dictionary

2008-03-09 Thread Guillermo
Mamma mia! My head just exploded. I've seen the light. So you only need to ·want· to have a protocol? That's amazing... Far beyond the claim that Python is easy. You define protocols in writing basically! Even my grandma could have her own Python protocol. Okay, so I think I know where's the cat

Re: Checking if a variable is a dictionary

2008-03-09 Thread Steven D'Aprano
On Sun, 09 Mar 2008 06:58:15 -0700, Guillermo wrote: > Okay, so I think I know where's the catch now -- you must rely on the > fact that the protocol is implemented, there's no way to enforce it if > you're expecting a parrot-like object. You'd try to call the speak() > method and deal with the er

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Kay Schluehr
On 9 Mrz., 13:50, Lie <[EMAIL PROTECTED]> wrote: > On Mar 9, 4:31 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 9 Mrz., 09:30, Lie <[EMAIL PROTECTED]> wrote: > > > On Mar 9, 12:05 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 9 Mrz., 04:51, Lie <[EMAIL PROTECTED]> wrote: > > >

Re: Converting a string to the most probable type

2008-03-09 Thread Malcolm Greene
Pierre, > That's fine for people who write floats with a "." ; but others learn to > enter them with "," I have also been looking for a similar Python conversion library. One of my requirements is that such a library must be locale aware (so it can make reasonable assumptions regarding locale pr

Re: for-else

2008-03-09 Thread egbert
On Sat, Mar 08, 2008 at 04:15:31PM -0500, Terry Reedy wrote: > > I am sorry if you cannot appreciate such elegance > and can only spit on it as 'orwellian'. > I admire the elegance of your examples and your explanation. I will keep a copy of it in my Beazley, for I am afraid I have to read it ag

unable to install gdal

2008-03-09 Thread luis
Hi On Windows xp sp2 and python 2.4 Yesterday I running old versions of gdal, and I try to upgrade I download gdalwin32exe150.zip and gdal-python-13.win32-py2.4.exe I unzip gdalwin32exe150.zip in C:\gdalwin32-1.5 I follow install's instructions from http://trac.osgeo.org/gdal/wiki/GdalOgrInPyt

Changing the size of a Button

2008-03-09 Thread K Viltersten
How do i change the size of a Button (using Tkinter), other than to set it during construction? I've found methods for getting the size but not applying them. I've been laborating with .setvar(*) but i've been unsuccessful. -- Regards Konrad Viltersten sleep

Returning values from function to Python shell/IPython

2008-03-09 Thread Karlo Lozovina
Hi all! I have a runTest() function inside my module, which sets up and initializes lots of objects and performs some basic tests on them. Usually (from IPython) I just write `run my_module.py`, and then `runTest()`. But sometimes I would like to manually twiddle with objects runTest creates. Is

Re: Returning values from function to Python shell/IPython

2008-03-09 Thread Jorge Vargas
On Sun, Mar 9, 2008 at 9:56 AM, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Hi all! > > I have a runTest() function inside my module, which sets up and initializes > lots of objects and performs some basic tests on them. Usually (from > IPython) I just write `run my_module.py`, and then `runTest

pure python hyphenator

2008-03-09 Thread Wilbert Berendsen
Hi all, I'm just new to this list and I'm a musician and hobby programmer. I am busy with LilyKDE, a python plugin package for KDE's editor Kate, that makes using the LilyPond music typesetter from within Kate easier. While already busy writing a python module for breaking lyrics text (using hy

Re: help on file storage for split multi part download

2008-03-09 Thread Gabriel Genellina
En Sat, 08 Mar 2008 08:27:12 -0200, <[EMAIL PROTECTED]> escribió: > On Mar 7, 2:14 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Fri, 07 Mar 2008 04:16:42 -0200, <[EMAIL PROTECTED]> escribi�: >> >> > BUT the thing thats going in my mind is thread safety. i plan to start >> > each part of

Re: Returning values from function to Python shell/IPython

2008-03-09 Thread Karlo Lozovina
Jorge Vargas wrote: > well after all it's a function so the only ways you can get things out > of it are: > - return a dict with all the objects > - use global (very messy) > - use a decorator to do either of the above. Messy, all of those... :(. > on the other hand have you consider using a pro

Need Help Building PythonQt on Windows

2008-03-09 Thread Jeff Schiller
Hello, I'm creating an application using Qt (4.4 Beta atm). I have pretty close to zero experience with Python (consisting of installing the Python interpreter, downloading a python programming and executing it on the command-line). I would like to invoke a Python script from my C++ Qt program a

Re: Returning values from function to Python shell/IPython

2008-03-09 Thread Jorge Vargas
On Sun, Mar 9, 2008 at 11:07 AM, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Jorge Vargas wrote: > > > well after all it's a function so the only ways you can get things out > > of it are: > > - return a dict with all the objects > > - use global (very messy) > > - use a decorator to do either

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Diez B. Roggisch
Jeff Schiller schrieb: > Hello, > > I'm creating an application using Qt (4.4 Beta atm). I have pretty > close to zero experience with Python (consisting of installing the > Python interpreter, downloading a python programming and executing it > on the command-line). > > I would like to invoke a

Re: Can't get items out of a set?

2008-03-09 Thread Raymond Hettinger
> > The intern() builtin uses this approach: > > >    interned = {} > >    def intern(s): > >         if s in interned: > >             return interned[s] > >         interned[s] = s > >         return s > > If you've seen it before, and have the old one, return the old one. > Do I have this straig

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Jeff Schiller
I said "PythonQt" not PyQt. That's an important distinction, I think :) See http://pythonqt.sourceforge.net/ Regards, Jeff On 3/9/08, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Jeff Schiller schrieb: > > > Hello, > > > > I'm creating an application using Qt (4.4 Beta atm). I have pretty >

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Michael Wieher
2008/3/9, Jeff Schiller <[EMAIL PROTECTED]>: > > Hello, I'm creating an application using Qt (4.4 Beta atm). I have pretty > close to zero experience with Python (consisting of installing the > Python interpreter, downloading a python programming and executing it > on the command-line). > > I

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Lie
On Mar 9, 7:54 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 09 Mar 2008 00:30:51 -0800, Lie wrote: > > (3) Informing codes above it about what's currently happening inside, > > the thing is just a mundane report that might be useful to codes above > > > Which might be

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Lie
On Mar 9, 9:29 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: (snip) > You are an appropriate person to consider the workflow in a dynamic > language, no matter how the language is implemented internally. I agree, but the only thing I'm not confident to talk about is how it'll be implemented, since I

Problems installing Python Imaging Library

2008-03-09 Thread Nick Day
Hi, I'm trying to install PIL from source on my CentOS 4.5 server. The build summary reports that I have everything installed... PIL 1.1.6 BUILD SUMMARY versio

Re: Changing the size of a Button

2008-03-09 Thread Miki
Hello Konrad, > How do i change the size of a Button > (using Tkinter), other than to set it > during construction? In Tkinter, usually the geometry managers (such as pack) are the ones who size the widgets. If you run something like: import Tkinter as tk root = tk.Tk() def change_siz

Re: Parse specific text in email body to CSV file

2008-03-09 Thread Miki
Hello, > I have been searching all over for a solution to this. I am new to > Python, so I'm a little lost. Any pointers would be a great help. I > have a couple hundred emails that contain data I would like to > incorporate into a database or CSV file. I want to search the email > for specific te

SV: Changing the size of a Button

2008-03-09 Thread K Viltersten
>> How do i change the size of a Button >> (using Tkinter), other than to set it >> during construction? > In Tkinter, usually the geometry managers > (such as pack) are the ones who size the > widgets. If you run something like: >import Tkinter as tk > >root = tk.Tk() >def change_si

Re: gc question

2008-03-09 Thread I V
On Sun, 09 Mar 2008 01:57:38 -0800, Vince wrote: > Well, that suits me. The most unnatural thing about Python was adapting > to the idea of just letting unreleased resources go jogging off > wherever. :) Yes, that's a bad habit that garbage collection can encourage. GC is good for managing memory

[ANN] pysqlite and APSW projects moved

2008-03-09 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dear pysqlite users! I've moved both the pysqlite and APSW project to new homes. pysqlite web:http://oss.itsystementwicklung.de/trac/pysqlite aka http://pysqlite.org/ scm:pysqlite now uses a Mercurial repository http://oss.i

Re: [pysqlite] [ANN] pysqlite and APSW projects moved

2008-03-09 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gerhard Häring wrote: > [...] APSW > > > web:http://oss.itsystementwicklung.de/trac/apsw/ > scm:Subversion: http://initd.org/svn/pysqlite/apsw/trunk/ That should have been http://oss.itsystementwicklung.de/svn/apsw/apsw/ - -- Gerhard --

Re: SV: Changing the size of a Button

2008-03-09 Thread Marc 'BlackJack' Rintsch
On Sun, 09 Mar 2008 19:45:58 +0100, K Viltersten wrote: > What i wish to do is to affect the size > of the button but not due to change of > text but due to resize of the frame it > resides in. > > This far i've managed to get a callback > to a function as the resize occurs and to > print the

Re: SV: Changing the size of a Button

2008-03-09 Thread Peter Otten
K Viltersten wrote: > What i wish to do is to affect the size > of the button but not due to change of > text but due to resize of the frame it > resides in. This is done by the layout manager, too: import Tkinter as tk root = tk.Tk() button = tk.Button(root, text="42") button.pack(fill=tk.BOT

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Diez B. Roggisch
Jeff Schiller schrieb: > I said "PythonQt" not PyQt. That's an important distinction, I think :) > > See http://pythonqt.sourceforge.net/ It sure is. Sorry, didn't realize the difference. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: the way of "import"

2008-03-09 Thread Gabriel Genellina
En Sat, 08 Mar 2008 00:30:13 -0200, smalltalk <[EMAIL PROTECTED]> escribi�: > I have three files names t1.py,t2.py,t3.py in e:\test\dir1,of course > dir2 is exsit > the content of t1.py as follow: > t1.py > import os > print 'this is t1.py' > os.chdir('..\\dir2') > the content of t2.py as follow

Re: del class with recursive list

2008-03-09 Thread duvo
Thanks! I just need to remember to del the variables after "for in". -- http://mail.python.org/mailman/listinfo/python-list

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread castironpi
D'Aprano suggested callbacks. How does this work for you? class SomeNumeric(object): def __div__(a, b): if b == 0: raise ZeroDivisionError ## Hard Exception... if a == 0: msgboard- ZeroNumerator() f = a / b i = a // b if f == float(i): msgb

__iter__ yield

2008-03-09 Thread duccio
Hello! Someone knows if it's possible to make this __iter__ function with just one 'yield' intead of two? Is there some simpler way to make this __iter__ iter through all nodes? Thanks! class Node: def __init__(self, data=None): self.childs=[] self.data=data def app

Re: Checking if a variable is a dictionary

2008-03-09 Thread castironpi
On Mar 9, 9:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 09 Mar 2008 06:58:15 -0700, Guillermo wrote: > > Okay, so I think I know where's the catch now -- you must rely on the > > fact that the protocol is implemented, there's no way to enforce it if > > you're exp

Re: parralel downloads

2008-03-09 Thread castironpi
> > > >>  my problem is that I would like to download several files at the time. > > > >>  As I have not much experience in programming, could you point me the > > > >>  easier ways to do this in python ? > > > Thank you both for your help. Threads are working for me. However, a > > new problem for

Re: parralel downloads

2008-03-09 Thread Gabriel Genellina
En Sat, 08 Mar 2008 14:47:45 -0200, Gary Herron <[EMAIL PROTECTED]> escribi�: > poof65 wrote: >> For your problem you have to use threads. >> > Not at all true. Thread provide one way to solve this, but another is > the select function. For this simple case, select() may (or may not) be > easi

Re: Regarding coding style

2008-03-09 Thread castironpi
On Mar 8, 7:51 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 08 Mar 2008 13:40:56 -0800, dave_mikesell wrote: > > On Mar 8, 2:27 pm, [EMAIL PROTECTED] wrote: > > >> Good comments are better than bad names. Good names are better than bad > >> comments. > > > If you're t

Re: Regarding coding style

2008-03-09 Thread castironpi
On Mar 9, 4:25 am, Lie <[EMAIL PROTECTED]> wrote: > On Mar 9, 3:27 am, [EMAIL PROTECTED] wrote: > > > To Lie: > > > > Personally I preferred a code that has chosen good names but have > > > little or no comments compared to codes that makes bad names and have > > > Personally I don't.  Show me a go

execute

2008-03-09 Thread Gif
i'm trying to execute a file without replacing the current process, but after searching the help file, documentations and the web, i can't a way of doing that. os.exec*() will close the current program. ps: by executing i mean like typing "mspaint" in run dialog.. it's not a python file -- http:

1.5.2 and functools or similar

2008-03-09 Thread Troels Thomsen
Hello, I am writing a simple delayed-call mechanism , that is causing a bit of headache. Works like this: myPrint(s) print "..." + s myTimer.add(myPrint , "hello" , 15) This means that the myprint function is called in 15 seconds with the parameter "hello". The housekeeping of these timers

Logically/Selectively Sub Class?

2008-03-09 Thread xkenneth
Might be a silly question, but is it possible to selectively subclass, IE subclass is a supporting module is present and not otherwise. Regards, Kenneth Miller -- http://mail.python.org/mailman/listinfo/python-list

Re: execute

2008-03-09 Thread Gif
i know os.popen() but i want to execute a file with args -- http://mail.python.org/mailman/listinfo/python-list

Re: execute

2008-03-09 Thread Gif
ok i found a workaround. -- http://mail.python.org/mailman/listinfo/python-list

Re: Logically/Selectively Sub Class?

2008-03-09 Thread Diez B. Roggisch
xkenneth schrieb: > Might be a silly question, but is it possible to selectively subclass, > IE subclass is a supporting module is present and not otherwise. Yes, something like this should work class Foo(some, base, classes) pass if condition: Temp = Foo class Foo(Temp, otherclass):

Re: execute

2008-03-09 Thread Dan Upton
On Sun, Mar 9, 2008 at 5:22 PM, Gif <[EMAIL PROTECTED]> wrote: > i'm trying to execute a file without replacing the current process, > but after searching the help file, documentations and the web, i can't > a way of doing that. > > os.exec*() will close the current program. > > ps: by executin

Re: 1.5.2 and functools or similar

2008-03-09 Thread castironpi
On Mar 9, 4:26 pm, "Troels Thomsen" wrote: > Hello, > > I am writing a simple delayed-call mechanism , that is causing a bit of > headache. Works like this: > > myPrint(s) >   print "..." + s > > myTimer.add(myPrint , "hello" , 15) > > This means that the myprint function is called in 15 seconds w

Re: Logically/Selectively Sub Class?

2008-03-09 Thread xkenneth
On Mar 9, 4:38 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > xkenneth schrieb: > > > Might be a silly question, but is it possible to selectively subclass, > > IE subclass is a supporting module is present and not otherwise. > > Yes, something like this should work > > class Foo(some, base, c

Re: Logically/Selectively Sub Class?

2008-03-09 Thread castironpi
On Mar 9, 4:28 pm, xkenneth <[EMAIL PROTECTED]> wrote: > Might be a silly question, but is it possible to selectively subclass, > IE subclass is a supporting module is present and not otherwise. > > Regards, > Kenneth Miller if mod is present: class Waypoint( Mine, Yours ): pass else: class

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Diez B. Roggisch
> Perhaps similar technique the compiler uses to determine whether a > function is a normal function or a generator function? Positive > forward lookup for any soft exceptions, which would then activate > matching soft exceptions inside the code? The difference between generators and functions is

Re: Logically/Selectively Sub Class?

2008-03-09 Thread Diez B. Roggisch
xkenneth schrieb: > On Mar 9, 4:38 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> xkenneth schrieb: >> >>> Might be a silly question, but is it possible to selectively subclass, >>> IE subclass is a supporting module is present and not otherwise. >> Yes, something like this should work >> >>

Re: __iter__ yield

2008-03-09 Thread Diez B. Roggisch
duccio schrieb: > > Hello! > Someone knows if it's possible to make this __iter__ function with just > one 'yield' intead of two? > Is there some simpler way to make this __iter__ iter through all nodes? > Thanks! > > class Node: > def __init__(self, data=None): > self.childs=[] >

Re: Regarding coding style

2008-03-09 Thread castironpi
> > >> Good comments are better than bad names. Good names are better than bad > > >> comments. > > > > If you're taking the time to write good comments, why not just fix the > > > bad names?  The compiler/interpreter can never, ever catch bad comments. > > > Yes, but the Python compiler can only c

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Martin v. Löwis
> Since I'm new to compiling Qt with mingw and completely new to python, > I was hoping for tips on why I'm getting these errors. If anyone has > a better suggestion for a forum/mailing list then please let me know. These symbols are all from pythonxy.dll. You need to add the corresponding impor

Re: 1.5.2 and functools or similar

2008-03-09 Thread Paul Rubin
"Troels Thomsen" writes: > timerItm.func(*timerItm.parameters) > > Works well on python 2.5 but not on 1.5.2 (?) I think in 1.5.2 the *args notation wasn't present and you had to say: apply(timerItm.func, timerItm.parameters) -- http://mail.python.org/mailman/listinfo/python-list

Re: __iter__ yield

2008-03-09 Thread Paul Hankin
On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > Someone knows if it's possible to make this __iter__ function with just   > one 'yield' intead of two? > ... >      def __iter__(self): >          yield self #1 >          for n in self.childs: >              for nn in n.__iter__(): >          

Distributed App - C++ with Python for Portability?

2008-03-09 Thread Roopan
Hello! I am looking at developing an enterprise-grade distributed data sharing application - key requirements are productivity and platform portability. Will it be sensible to use C++ for performance-critical sections and Python for all the glue logic. Pls comment from your *experiences* how Pyt

Re: execute

2008-03-09 Thread castironpi
> >  os.exec*() will close the current program. > > On *nix, you can use os.fork().  According > tohttp://effbot.org/librarybook/os.htm, you can use Do you mean, and block for the process to terminate? Or do you mean, do something else in the meantime, perhaps for a certain amount (of meantime)?

Re: Beautiful Code in Python?

2008-03-09 Thread castironpi
On Mar 2, 1:18 pm, [EMAIL PROTECTED] wrote: > On Mar 2, 12:01 pm, John DeRosa <[EMAIL PROTECTED]> wrote: > > > On Mon, 3 Mar 2008 01:23:32 +0900, js <[EMAIL PROTECTED]> wrote: > > >Hi, > > > >Have you ever seen Beautiful Python code? > > >Zope? Django? Python standard lib? or else? > > > >Please te

Re: Intra-Package References

2008-03-09 Thread Gabriel Genellina
En Sat, 08 Mar 2008 17:36:12 -0200, xkenneth <[EMAIL PROTECTED]> escribió: > Does your python module have to exist in the path in order for intra- > package references to work? No, but Python must be aware that the importing module is inside a package. So the script being executed (main) should

Re: 1.5.2 and functools or similar

2008-03-09 Thread Terry Reedy
"Troels Thomsen" <"nej tak..."@bag.python.org> wrote in message news:[EMAIL PROTECTED] | def updateTimers() | for timerItm in timerTable: | ... | | |timerItm.func(*timerItm.parameters) | | Works well on python 2.5 but not on 1.5.2 (?) apply(timerItm.func, timerItm.par

Re: Returning values from function to Python shell/IPython

2008-03-09 Thread castironpi
> >  > well after all it's a function so the only ways you can get things out > >  > of it are: > >  > - return a dict with all the objects > >  > - use global (very messy) > >  > - use a decorator to do either of the above. > > >  Messy, all of those... :(. > > >  > on the other hand have you cons

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread castironpi
On Mar 9, 4:51 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Perhaps similar technique the compiler uses to determine whether a > > function is a normal function or a generator function? Positive > > forward lookup for any soft exceptions, which would then activate > > matching soft excepti

any chance regular expressions are cached?

2008-03-09 Thread mh
I've got a bit of code in a function like this: s=re.sub(r'\n','\n'+spaces,s) s=re.sub(r'^',spaces,s) s=re.sub(r' *\n','\n',s) s=re.sub(r' *$','',s) s=re.sub(r'\n*$','',s) Is there any chance that these will be cached somewhere, and save me the trouble of having to declare som

Re: parralel downloads

2008-03-09 Thread castironpi
> > That's it.  Far easier than threads. I'll order a 'easyness' metric from the warehouse. Of course, resources are parameters to the metric, such as facility given lots of time, facility given lots of libraries, facility given hot shots, &c. > Easier? If you omit all the relevant details, yes,

Re: any chance regular expressions are cached?

2008-03-09 Thread Tim Chase
> s=re.sub(r'\n','\n'+spaces,s) > s=re.sub(r'^',spaces,s) > s=re.sub(r' *\n','\n',s) > s=re.sub(r' *$','',s) > s=re.sub(r'\n*$','',s) > > Is there any chance that these will be cached somewhere, and save > me the trouble of having to declare some global re's if I don't > want t

Re: Timed execution in eval

2008-03-09 Thread castironpi
> >  > and I want to be able to stop [functions] if they run too long. > > > That's tricky [due to a synthetic limitation]. It would suck if you couldn't hold the GIL for as long as you need to. But how much is it used? Wrote the docs: > when two threads simultaneously increment the reference co

RE: any chance regular expressions are cached?

2008-03-09 Thread Ryan Ginstrom
> On Behalf Of Tim Chase > Sounds like what you want is to use the compile() call to > compile once, and then use the resulting objects: > >re1 = re.compile(r'\n') >re2 = re.compile(r'^') >... >s = re1.sub('\n' + spaces, s) >s = re2.sub(spaces, s) Yes. And I would go a step f

Re: Timed execution in eval

2008-03-09 Thread castironpi
> Write the docs: > > > when two threads simultaneously increment the reference count of the same > > object > > Well, the example sucked.  Just synchronize ref count manipulation. > Every OS has locking primitives, and a library exists to deny requests > to block that lock dead.  How integral is

python-2.5.2 src rpm

2008-03-09 Thread Donald Raikes
Hello, I am trying to install python 2.5.2 onto enterprise linux, and would like to start with a source rpm package so that I can build the package locally and make sure I have all necessary dependencies. I have been unable to locate a source rpm package for python 2.5.2 or any version of 2.5

Re: Uninstalling Eggs

2008-03-09 Thread Mike Driscoll
On Mar 9, 8:30 am, PB <[EMAIL PROTECTED]> wrote: > I just installed the Shove module with the monumentally crap > setuptools. Whilst the install succeeded, imports now trigger errors, > so clearly it did not install correctly. Can I simply delete the .egg > file from my lib/python2.3/site-packages/

Python 2.5 segmentation faulting importing random

2008-03-09 Thread Bagpussnz
Hi, Whenever I try to import random in a python module, I get a segmentation fault. I've traced it using, import pdb pdb.set_trace() import random When it gets to.. > /usr/lib/python2.5/random.py(57)() -> LOG4 = _log(4.0) It seg faults. I'm running on OpenSuse 10.2. Linux devhost 2.6.18.8-0.7-

Re: any chance regular expressions are cached?

2008-03-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I've got a bit of code in a function like this: | |s=re.sub(r'\n','\n'+spaces,s) |s=re.sub(r'^',spaces,s) |s=re.sub(r' *\n','\n',s) |s=re.sub(r' *$','',s) |s=re.sub(r'\n*$','',s) | | Is there any chance that these w

Re: Solve a Debate

2008-03-09 Thread castironpi
> days_in_month 12: > 31 > 30 > 28 > 31 > ... > 30 > 31 > assign $days days_in_month[$month] > > This program consists of 2 operations (table jump and assignment) > and 12 values. This makes a memory consumption of 12+2 = 14 Along the same lines, you could populate the table somewhat sparsely, and

Import - interpreter works but .py import does not

2008-03-09 Thread John Boy
First post and very much a newbie to Python. Have 2.5 on Linux (GG). I think I have set up PYTHONPATH correctly in that I can import a module apply_bp and it complains about line 20 in apply_bp which is: import sys, aipy, numpy, os At the interpreter prompt, however, I can import sys, numpy etc.

  1   2   >