Re: Find the location of a loaded module

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 20:44:21 -0200, Aaron Scott escribió: So, the problem lies with how Python cached the modules in memory. Yes, the modules were in two different locations and yes, the one that I specified using its direct path should be the one loaded. The problem is, the module isn't alwa

Re: how to assert that method accepts specific types

2009-02-20 Thread Rhodri James
On Sat, 21 Feb 2009 01:12:01 -, Darren Dale wrote: I would like to assert that a method accepts certain types. I have a short example that works: from functools import wraps def accepts(*types): def check_accepts(f): @wraps(f) def new_f(self, other): assert

Re: Python won't run

2009-02-20 Thread Scott David Daniels
Chris Rebert wrote: On Fri, Feb 20, 2009 at 4:52 PM, kevin hayes wrote: Hi, I had python 2.5 installed on my Mac osx 10.4.11 and idle stopped opening and running after I ran a few programs. I installed python 2.6 hoping this would allow me to open idle and start learning to program. How do I

Re: multiprocessing module and os.close(sys.stdin.fileno())

2009-02-20 Thread Joshua Judson Rosen
Jesse Noller writes: > > On Tue, Feb 17, 2009 at 10:34 PM, Graham Dumpleton > wrote: > > Why is the multiprocessing module, ie., multiprocessing/process.py, in > > _bootstrap() doing: > > > > os.close(sys.stdin.fileno()) > > > > rather than: > > > > sys.stdin.close() > > > > Technically it is f

Re: "Byte" type?

2009-02-20 Thread John Nagle
Steve Holden wrote: John Nagle wrote: Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote: ...Re "bytes" not behaving as documented in 2.6: That's indeed how Python 2.6 works. But that's not how PEP 3137 says it's supposed to work. Guido: "I propose the followi

Re: function factory question: embed current values of object attributes

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 16:49:21 -0200, Alan Isaac escribió: I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, but is there way to communicate to a method that it depends only on the initial values of

Re: can multi-core improve single funciton?

2009-02-20 Thread Kurt Smith
On Fri, Feb 20, 2009 at 4:27 PM, Grant Edwards wrote: > On one hand, the upshot of that is that by finding an > appropriate library module you might gain some of the same > benefits as removing the GIL. > > On the other hand, that doesn't help if you're doing something > original enough that nobod

Re: Killing subservient threads

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 16:15:10 -0200, jimzat escribió: I am using the thread module and calling thread.start_new_thread (...). If I use t=thread.start_new_thread(...) and later set t.terminate, I get "AttributeError: 'int' object has no attribute 'terminate'" Use the threading module instead,

Re: Changing the Image on a button

2009-02-20 Thread odeits
On Feb 17, 7:14 am, John Posner wrote: >  >> > Try this change: >  >> > >  >> >   from: btn.configure(image = None) >  >> >     to: img1.blank() >  >> > >  >> >  >> This does in fact clear the image out, however it isn't causing the >  >> text to display... Do i have have to create a new button an

Re: Pythonic way to determine if one char of many in a string

2009-02-20 Thread odeits
On Feb 15, 11:31 pm, odeits wrote: > On Feb 15, 9:56 pm, Chris Rebert wrote: > > > > > On Sun, Feb 15, 2009 at 9:17 PM,   wrote: > > > I need to test strings to determine if one of a list of chars is in the > > > string. A simple example would be to test strings to determine if they > > > have >

Re: Python won't run

2009-02-20 Thread Ned Deily
In article <37c2b0840902201751q5ac4b607n14c90ee0b51c1...@mail.gmail.com>, kevin hayes wrote: > I installed it...with the package that came with python 2.6. When I had 2.5 > I was using it(idle) successfully, until I ran a few programs that I got off > the web. Then, Idle wouldn't open (it just

Re: Framework installation of 2.6 on OS X, with specified prefix

2009-02-20 Thread Evert Rol
On 20 Feb 2009, at 21:48 , Ned Deily wrote: In article , Evert Rol wrote: I'm trying to install Python 2.6 from source on Mac OS X.5, in its own directory using a framework install. That goes fine, up to the point where it wants to install the applications that come with it (eg, the Wish sh

Re: Using clock() in threading on Windows

2009-02-20 Thread Christian Heimes
Maxim Khitrov wrote: > The threading module uses time.time in _Condition and _Thread classes > to implement timeouts. On Windows, time() typically has a resolution > of 15.625ms. In addition, if the system clock is changed (though ntp, > for example) it would reflect that change, causing the timeou

Re: Python won't run

2009-02-20 Thread kevin hayes
I installed it...with the package that came with python 2.6. When I had 2.5 I was using it(idle) successfully, until I ran a few programs that I got off the web. Then, Idle wouldn't open (it just bounced in the dock and then disappeared). So I tried installing 2.6 and the same thing happened. On

Re: how to assert that method accepts specific types

2009-02-20 Thread andrew cooke
Darren Dale wrote: > I would like to assert that a method accepts certain types. I have a > short example that works: just in case it's useful - are you aware that pep3107 (which looks like it should be leet-speak for something) is implemented in python 3? http://www.python.org/dev/peps/pep-3107/

Re: how to assert that method accepts specific types

2009-02-20 Thread Terry Reedy
Darren Dale wrote: I would like to assert that a method accepts certain types. I have a short example that works: from functools import wraps def accepts(*types): def check_accepts(f): @wraps(f) def new_f(self, other): assert isinstance(other, types), \

Re: how to assert that method accepts specific types

2009-02-20 Thread Darren Dale
On Feb 20, 8:20 pm, Chris Rebert wrote: > On Fri, Feb 20, 2009 at 5:12 PM, Darren Dale wrote: > > I would like to assert that a method accepts certain types. I have a > > short example that works: > > > from functools import wraps > > > def accepts(*types): > >    def check_accepts(f): > >      

Re: Python won't run

2009-02-20 Thread Chris Rebert
Hmm. How did you install Python/IDLE? Also, please use Reply-All as others on the list might have helpful ideas. - Chris On Fri, Feb 20, 2009 at 5:34 PM, kevin hayes wrote: > I was clicking on the application. then the idle/python icon would bounce > in my > dock and then disappear. > On Fri, F

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Terry Reedy
Martin v. Löwis wrote: mehow have picked up a latin-1 encoding.) I think latin-1 was the default without a coding cookie line. (May be uft-8 in 3.0). It is, but that's irrelevant for the example. In the source u'\xb5' all characters are ASCII (i.e. all of "letter u", "single quote", "backs

Re: Python won't run

2009-02-20 Thread Chris Rebert
How were you running IDLE previously? - Chris On Fri, Feb 20, 2009 at 5:24 PM, kevin hayes wrote: > how do i do that? > > On Fri, Feb 20, 2009 at 5:20 PM, Chris Rebert wrote: >> >> I meant, what happens when you run *IDLE* from the command line? >> >> - Chris >> >> On Fri, Feb 20, 2009 at 5:16

Re: how to assert that method accepts specific types

2009-02-20 Thread Chris Rebert
On Fri, Feb 20, 2009 at 5:12 PM, Darren Dale wrote: > I would like to assert that a method accepts certain types. I have a > short example that works: > > from functools import wraps > > def accepts(*types): >def check_accepts(f): >@wraps(f) >def new_f(self, other): >

how to assert that method accepts specific types

2009-02-20 Thread Darren Dale
I would like to assert that a method accepts certain types. I have a short example that works: from functools import wraps def accepts(*types): def check_accepts(f): @wraps(f) def new_f(self, other): assert isinstance(other, types), \ "arg %r does n

python-list@python.org

2009-02-20 Thread John Machin
On Feb 21, 3:46 am, Allen wrote: > I am using Python with cx_oracle to load an excel spreadsheet into an > Oracle table. There are lots of text on the spreadsheet that have "&" > in them which I want to keep in the table. But inserting those text > will fail. "Will fail" (future tense) or have fa

Re: Python won't run

2009-02-20 Thread Chris Rebert
On Fri, Feb 20, 2009 at 4:52 PM, kevin hayes wrote: > Hi, I had python 2.5 installed on my Mac osx 10.4.11 and idle stopped > opening and running after I ran a few programs. I installed python 2.6 > hoping this would allow me to open idle and start learning to program. How > do I get Idle runnin

Python won't run

2009-02-20 Thread kevin hayes
Hi, I had python 2.5 installed on my Mac osx 10.4.11 and idle stopped opening and running after I ran a few programs. I installed python 2.6 hoping this would allow me to open idle and start learning to program. How do I get Idle running again? -- http://mail.python.org/mailman/listinfo/python-li

Re: "import" not working?

2009-02-20 Thread Lionel
On Feb 20, 4:15 pm, Matimus wrote: > On Feb 20, 3:56 pm, Lionel wrote: > > > > > > > On Feb 20, 3:52 pm, Chris Rebert wrote: > > > > On Fri, Feb 20, 2009 at 3:33 PM, Lionel wrote: > > > > Hello all: > > > > > I've crafted several classes and exceptions which I've stored in a > > > > file called

Re: "import" not working?

2009-02-20 Thread Steve Holden
Chris Rebert wrote: > On Fri, Feb 20, 2009 at 3:33 PM, Lionel wrote: >> Hello all: >> >> I've crafted several classes and exceptions which I've stored in a >> file called "DataFileType.py". I then invoke them from within other >> files like this: >> >> >> # Top of file >> >> import sys >> sys.path

Re: "import" not working?

2009-02-20 Thread Matimus
On Feb 20, 3:56 pm, Lionel wrote: > On Feb 20, 3:52 pm, Chris Rebert wrote: > > > > > On Fri, Feb 20, 2009 at 3:33 PM, Lionel wrote: > > > Hello all: > > > > I've crafted several classes and exceptions which I've stored in a > > > file called "DataFileType.py". I then invoke them from within oth

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f397c.7030...@v.loewis.de>, "Martin v. Löwis" wrote: > > Yes, I know that. But every concrete representation of a unicode string > > has to have an encoding associated with it, including unicode strings > > produced by the Python parser when it parses the ascii string "u'\xb5'"

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f3a8f.9010...@v.loewis.de>, "Martin v. Löwis" wrote: > > u'\xb5' > >> u'\xb5' > > print u'\xb5' > >> ? > > > > Unicode literals are *in the source file*, which can only have one > > encoding (for a given source file). > > > >> (That last character shows up as a micron si

Using clock() in threading on Windows

2009-02-20 Thread Maxim Khitrov
Greetings, The threading module uses time.time in _Condition and _Thread classes to implement timeouts. On Windows, time() typically has a resolution of 15.625ms. In addition, if the system clock is changed (though ntp, for example) it would reflect that change, causing the timeout to last longer

Re: "import" not working?

2009-02-20 Thread Lionel
On Feb 20, 3:52 pm, Chris Rebert wrote: > On Fri, Feb 20, 2009 at 3:33 PM, Lionel wrote: > > Hello all: > > > I've crafted several classes and exceptions which I've stored in a > > file called "DataFileType.py". I then invoke them from within other > > files like this: > > > # Top of file > > > i

Re: "import" not working?

2009-02-20 Thread Chris Rebert
On Fri, Feb 20, 2009 at 3:33 PM, Lionel wrote: > Hello all: > > I've crafted several classes and exceptions which I've stored in a > file called "DataFileType.py". I then invoke them from within other > files like this: > > > # Top of file > > import sys > sys.path.append("c:\DataFileTypes") Reca

Re: "import" not working?

2009-02-20 Thread Emile van Sebille
Lionel wrote: from DataFileTypes import * That's an import where you don't know what's getting import'd -- ie, namespace pollution [snip] from wx import * and more here. Try being explicit with your naming. HTH, Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: count secton of data in list

2009-02-20 Thread Emile van Sebille
brianrpsgt1 wrote: def step1(val): data2_row = [] for d1r in data1_row: if d1r[1] >= val: switch = 0 data2_row = d1r[0],d1r[1],d1r[2],switch data2_row.append([d1r[0],d1r[1],d1r[2],switch]) HTH, Emile -- http://mail.python.org/mailma

"import" not working?

2009-02-20 Thread Lionel
Hello all: I've crafted several classes and exceptions which I've stored in a file called "DataFileType.py". I then invoke them from within other files like this: # Top of file import sys sys.path.append("c:\DataFileTypes") from DataFileTypes import * data = None try: # Note: "INTData" is

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Martin v. Löwis
> u'\xb5' >> u'\xb5' > print u'\xb5' >> � > > Unicode literals are *in the source file*, which can only have one > encoding (for a given source file). > >> (That last character shows up as a micron sign despite the fact that >> my default encoding is ascii, so it seems to me that that un

count secton of data in list

2009-02-20 Thread brianrpsgt1
I have a list of three columns of data. I run the following code: def step1(val): for d1r in data1_row: if d1r[1] >= val: switch = 0 data2_row = d1r[0],d1r[1],d1r[2],switch print d1r[0],d1r[1],d1r[2],switch else: switch = 1

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Martin v. Löwis
> Yes, I know that. But every concrete representation of a unicode string > has to have an encoding associated with it, including unicode strings > produced by the Python parser when it parses the ascii string "u'\xb5'" > > My question is: what is that encoding? The internal representation is

Re: Implementaion of random.shuffle

2009-02-20 Thread Scott David Daniels
Steven D'Aprano wrote: On Wed, 18 Jul 2007 19:32:35 +, George Sakkis wrote: ... Wow, can you make a coffee in.. 57ms ? [snip demonstration of xrange raising an exception] Of course! Can't you? And if I use a microwave oven, [*** deleted section outlining Guido's time machine structur

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
And finally, an epilogue. So, the problem lies with how Python cached the modules in memory. Yes, the modules were in two different locations and yes, the one that I specified using its direct path should be the one loaded. The problem is, the module isn't always loaded -- if it's already in memor

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Matthew Woodcraft
Ron Garret writes: > Put this another way: I would have thought that when the Python parser > parses "u'\xb5'" it would produce the same result as calling > unicode('\xb5'), but it doesn't. Instead it seems to produce the same > result as calling unicode('\xb5', 'latin-1'). But my default encoding

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Dan Goodman
This sounds kind of similar to a problem I posted to this list last year, you might find that thread gives you some ideas: http://mail.python.org/pipermail/python-list/2008-January/474071.html Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading and tkinter

2009-02-20 Thread Craig Allen
> The statement > >     x=x+1 > > (which, by the way, should stylistically be written > >     x = x + 1 > yes I was wondering what "x=x+1" meant until you translated it... oh, "x = x + 1" of course! I thought to myself. Oh wait no I'm sarcastic. -- http://mail.python.org/mailman/listinfo/python-

Re: can multi-core improve single funciton?

2009-02-20 Thread Grant Edwards
On 2009-02-20, Robert Kern wrote: > >> Do the crunchy bits of scipy/numpy, scientific python, vtk and >> other compute-intensive libraries tend to release the GIL >> while they're busy "computing"? > > Often. Not as often as they could, sometimes. On one hand, the upshot of that is that by findin

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread andrew cooke
from subsequent posts i think you were looking for something "smarter" than my streams, but i was interested in the idea, so i wrote an implementation. hope this is ok - if you don't want to see a worked solution, read no further... i have been using generators a lot recently; now that i understa

python-list@python.org

2009-02-20 Thread Steve Holden
Allen wrote: > I am using Python with cx_oracle to load an excel spreadsheet into an > Oracle table. There are lots of text on the spreadsheet that have "&" > in them which I want to keep in the table. But inserting those text > will fail. Why do you say that? > Is there a work around for this? I

Re: can multi-core improve single funciton?

2009-02-20 Thread Robert Kern
On 2009-02-20 13:20, Unknown wrote: On 2009-02-20, Aahz wrote: Steven D'Aprano wrote: As I understand it, there's very little benefit to multi-cores in Python due to the GIL. As phrased, your statement is completely wrong. Here's a more correct phrasing: "For threaded compute-bound applica

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Terry Reedy
Ron Garret wrote: I would have thought that the answer would be: the default encoding (duh!) But empirically this appears not to be the case: unicode('\xb5') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in position 0: ord

Re: function factory question: embed current values of object attributes

2009-02-20 Thread Terry Reedy
Alan Isaac wrote: I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, 'Parameters' are the function local names in the header that get bound to argument objects when the function is called. What you

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
> > 'req.write(story.game.Save())' returns '/home/www/--/docs/act2/ > storylab/game.pyc' as the file being accessed. > Sorry, that should have read: > 'req.write(story.game.Save())' returns > '/home/www/--/docs/act2/story/game.pyc' as the file being accessed. -- http://mail.python.org/mailman/lis

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
Son of a bitch. It gets worse. > Executed from inside 'act1', which contains the directory / module > 'story': > >         directory = os.path.dirname(__file__) >         req.write(str(directory)) >         story = apache.import_module('story', path=[directory]) > > Results: > > /home/www/---/do

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
And more madness... Executed from inside 'act1', which contains the directory / module 'story': directory = os.path.dirname(__file__) req.write(str(directory)) story = apache.import_module('story', path=[directory]) Results: File "/home/www/---/docs/act1/play.py", l

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f18bd$0$31879$9b4e6...@newsspool3.arcor-online.net>, Stefan Behnel wrote: > Ron Garret wrote: > > I would have thought that the answer would be: the default encoding > > (duh!) But empirically this appears not to be the case: > > > unicode('\xb5') > > Traceback (most recen

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-20 Thread Dotan Cohen
> Even 3DS or Maya is easier to learn that Blender. > Notepad is easier to learn that VI. Not a good program does simple make. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Stefan Behnel
Stefan Behnel wrote: > print u'\xb5' >> µ > > What you > see in the last line is what the Python interpreter makes of your unicode > string when passing it into stdout, which in your case seems to use a > latin-1 encoding (check your environment settings for that). The "seems to" is misleadin

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Stefan Behnel
Ron Garret wrote: > I would have thought that the answer would be: the default encoding > (duh!) But empirically this appears not to be the case: > unicode('\xb5') > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in pos

Re: Framework installation of 2.6 on OS X, with specified prefix

2009-02-20 Thread Ned Deily
In article , Evert Rol wrote: > I'm trying to install Python 2.6 from source on Mac OS X.5, in its own > directory using a framework install. That goes fine, up to the point > where it wants to install the applications that come with it (eg, the > Wish shell): it tries to install things int

Re: To unicode or not to unicode

2009-02-20 Thread Martin v. Löwis
Ron Garret wrote: > In article <499f0cf0.8070...@v.loewis.de>, > "Martin v. Löwis" wrote: > > > I'm the OP. I'm using MT-Newswatcher 3.5.1. I thought I had it > configured properly, but I guess I didn't. Probably you did. However, it then means that the newsreader is crap. > Under > Pref

Re: Will multithreading make python less popular?

2009-02-20 Thread rushenaly
I want to correct my last post where i said that there is not any intend to remove GIL from python. There is an intend actually i wish from a wizard :). On the pypy blog there is an explanation about gil and pypy "Note that multithreading in PyPy is based on a global interpreter lock, as in CPython

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
Here's another clue: if I'm trying to run the script from the directory 'act1', but it's loading the module from 'act2', if I rename the module directory in 'act2' and refresh, the module still reports that it's running from '/home/www/---/docs/act2/story/game.pyc'... even though that files no long

Re: To unicode or not to unicode

2009-02-20 Thread Ron Garret
In article <499f0cf0.8070...@v.loewis.de>, "Martin v. Löwis" wrote: > MRAB wrote: > > Thorsten Kampe wrote: > >> * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) > >>> I'm writing a little wiki that I call µWiki. That's a lowercase > >>> Greek mu at the beginning (it's pronounced micro-wiki).

Re: To unicode or not to unicode

2009-02-20 Thread Martin v. Löwis
MRAB wrote: > Thorsten Kampe wrote: >> * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) >>> I'm writing a little wiki that I call µWiki. That's a lowercase >>> Greek mu at the beginning (it's pronounced micro-wiki). >> >> No, it's not. I suggest you start your Unicode adventure by >> configuring yo

What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
I would have thought that the answer would be: the default encoding (duh!) But empirically this appears not to be the case: >>> unicode('\xb5') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in position 0: ordinal not in range(

Re: To unicode or not to unicode

2009-02-20 Thread Ron Garret
In article , MRAB wrote: > Thorsten Kampe wrote: > > * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) > >> I'm writing a little wiki that I call µWiki. That's a lowercase Greek > >> mu at the beginning (it's pronounced micro-wiki). > > > > No, it's not. I suggest you start your Unicode advent

Re: can multi-core improve single funciton?

2009-02-20 Thread Grant Edwards
On 2009-02-20, Aahz wrote: > Steven D'Aprano wrote: > >> As I understand it, there's very little benefit to multi-cores >> in Python due to the GIL. > > As phrased, your statement is completely wrong. Here's a more > correct phrasing: "For threaded compute-bound applications > written in pure

Re: Regular expression bug?

2009-02-20 Thread umarpy
More elegant way >>> [x for x in re.split('([A-Z]+[a-z]+)', a) if x ] ['foo', 'Bar', 'Baz'] R. On Feb 20, 2:03 pm, Lie Ryan wrote: > On Thu, 19 Feb 2009 13:03:59 -0800, Ron Garret wrote: > > In article , > >  Peter Otten <__pete...@web.de> wrote: > > >> Ron Garret wrote: > > >> > I'm trying to

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
Okay, I'm going out of my mind. I have three directories -- 'act1', 'act2', and 'act3'. Each of these has a module named 'story'. Through mod_python, I need to load 'story' in the directory 'act1'. I do it like this: req.content_type = "text/html" sys.path.append(os.path.dirname(

function factory question: embed current values of object attributes

2009-02-20 Thread Alan Isaac
I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, but is there way to communicate to a method that it depends only on the initial values of these parameters (and does not need to worry about any changes

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Paddy O'Loughlin
2009/2/20 Bruno Desthuilliers : > Check by yourself: > import inspect inspect.isfunction(property) > False Using this, every single builtin function returns False. That's a pretty limited definition to be being pedantic over, especially when they are in the "Built-in Functions" section of

Re: Find the location of a loaded module

2009-02-20 Thread Christian Heimes
Aaron Scott schrieb: > I'm running into a problem that's rapidly reaching keyboard-smashing > levels. I'm trying to import a module into Python, but it seems like > Python is almost randomly loading the module from an entirely > different directory, one that shouldn't be in the module search path.

Find the location of a loaded module

2009-02-20 Thread Aaron Scott
I'm running into a problem that's rapidly reaching keyboard-smashing levels. I'm trying to import a module into Python, but it seems like Python is almost randomly loading the module from an entirely different directory, one that shouldn't be in the module search path. When I tell Python to load a

Re: is it possible to add a property to an instance?

2009-02-20 Thread Alan Isaac
Darren Dale wrote to GHUM: Sorry, that's an attribute, not a property. This is a question about terminology. In contrast to Darren's recommended usage, I have run into the following. If hasattr(x,'a') is True, for instance object `x`, then `a` is an attribute of `x`. Attributes are data attri

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Tim Wintle
On Fri, 2009-02-20 at 16:38 +, Nigel Rantor wrote: > Luke Dunn wrote: That was my initial thought when I read this too - but I'm not certain that is guaranteed to find a solution (i.e. a solution that's optimal). I'd welcome a proof that it will though, a few minutes thought hasn't found a

Re: How Can I run some Python Scripts in VS C++?

2009-02-20 Thread david
On Feb 20, 11:12 am, "Gabriel Genellina" wrote: > En Fri, 20 Feb 2009 15:47:06 -0200, david escribió: > > > Basically I have some python scripts to do some document processing, > > all in command line tho. > > I want to have an C++ application so that my scripts can run in dialogs > > (API). > >

Re: Killing subservient threads

2009-02-20 Thread jimzat
On Feb 20, 11:21 am, "Gabriel Genellina" wrote: > 1) make the child window set a flag in the thread (let's say, t.terminate   > = True). And make the polling thread check the flag periodically (you   > possibly already have a loop there - just break the loop when you detect   > that self.terminate

Re: Killing subservient threads

2009-02-20 Thread jimzat
On Feb 20, 11:22 am, koranthala wrote: > > thread.setDaemon(True) > Makes it a daemon thread which means that interpreter will not stay > alive if only that thread is alive. My main window is used to launch multiple children and therefore when one is dismissed the interpreter will remain active.

Re: How Can I run some Python Scripts in VS C++?

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 15:47:06 -0200, david escribió: Basically I have some python scripts to do some document processing, all in command line tho. I want to have an C++ application so that my scripts can run in dialogs (API). I saw a post before using c# to run python scripts within the c# main.

Re: can multi-core improve single funciton?

2009-02-20 Thread Aahz
In article , Steven D'Aprano wrote: > >As I understand it, there's very little benefit to multi-cores in Python >due to the GIL. As phrased, your statement is completely wrong. Here's a more correct phrasing: "For threaded compute-bound applications written in pure Python, there's very little

Re: To unicode or not to unicode

2009-02-20 Thread MRAB
Thorsten Kampe wrote: * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) I'm writing a little wiki that I call µWiki. That's a lowercase Greek mu at the beginning (it's pronounced micro-wiki). No, it's not. I suggest you start your Unicode adventure by configuring your newsreader. It looked

Re: To unicode or not to unicode

2009-02-20 Thread Thorsten Kampe
* Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) > I'm writing a little wiki that I call µWiki. That's a lowercase Greek > mu at the beginning (it's pronounced micro-wiki). No, it's not. I suggest you start your Unicode adventure by configuring your newsreader. Thorsten -- http://mail.python.or

Re: How Can I run some Python Scripts in VS C++?

2009-02-20 Thread david
> > No: please explain in more detail what you want to do. > > -- > Gabriel Genellina Thanks for the fast reply Gabriel, Basically I have some python scripts to do some document processing, all in command line tho. I want to have an C++ application so that my scripts can run in dialogs (API). I sa

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Bruno Desthuilliers
Paddy O'Loughlin a écrit : 2009/2/20 Bruno Desthuilliers : Interesting. Why shouldn't you? I haven't used the property() function s/function/object/ Nice try, but what I wrote was what I intended to say: http://docs.python.org/library/functions.html#property Check by yourself: >>> import i

pymssql text type

2009-02-20 Thread marc wyburn
Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the follwoing error. (, OperationalError("SQL Server message 102, severity 15, state 1, line 1:\nIncorrect syntax near 'assigned'.\n",), ) the string it is having an issue with is (\r\n\r\n\tLogon ID:\t\t(0x0,0xE892A8)\r\n\r\n\tLo

Re: Killing subservient threads

2009-02-20 Thread Christian Heimes
Gabriel Genellina wrote: > 1) make the child window set a flag in the thread (let's say, > t.terminate = True). And make the polling thread check the flag > periodically (you possibly already have a loop there - just break the > loop when you detect that self.terminate became true) threading.Condi

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
W. eWatson wrote: David Smith wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the

Re: How Can I run some Python Scripts in VS C++?

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 15:14:52 -0200, bing escribió: Hi, I have some simple python scripts, anyone knows how to run the Python Scripts in C++? Any code example would be really helpful and appreciated. Do you want to write a C++ application, and allow your users to write scripts in Python, pos

Re: Killing subservient threads

2009-02-20 Thread koranthala
On Feb 20, 9:47 pm, jimzat wrote: > I am trying to create an app which will have a main window from which > the user will launch other (children) windows. > > When I launch the child window I start a new thread which periodically > polls another device and updates the child window accordingly.  Wh

Re: Killing subservient threads

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 14:47:27 -0200, jimzat escribió: I am trying to create an app which will have a main window from which the user will launch other (children) windows. When I launch the child window I start a new thread which periodically polls another device and updates the child window acc

How Can I run some Python Scripts in VS C++?

2009-02-20 Thread bing
Hi, I have some simple python scripts, anyone knows how to run the Python Scripts in C++? Any code example would be really helpful and appreciated. -- http://mail.python.org/mailman/listinfo/python-list

Re: Keeping the Console Open with IDLE

2009-02-20 Thread MRAB
Catherine Heathcote wrote: W. eWatson wrote: Catherine Heathcote wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Ty

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Paddy O'Loughlin
2009/2/20 Bruno Desthuilliers : >> Interesting. Why shouldn't you? >> I haven't used the property() function > > s/function/object/ Nice try, but what I wrote was what I intended to say: http://docs.python.org/library/functions.html#property For all I know I could have used property objects sever

Killing subservient threads

2009-02-20 Thread jimzat
I am trying to create an app which will have a main window from which the user will launch other (children) windows. When I launch the child window I start a new thread which periodically polls another device and updates the child window accordingly. When I dismiss the child window the "polling"

python-list@python.org

2009-02-20 Thread Allen
I am using Python with cx_oracle to load an excel spreadsheet into an Oracle table. There are lots of text on the spreadsheet that have "&" in them which I want to keep in the table. But inserting those text will fail. Is there a work around for this? I can filter out the failed insert statements a

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Nigel Rantor
Trip Technician wrote: yes n^n^n would be fine. agree it is connected to factorisation. building a tree of possible expressions is my next angle. I think building trees of the possible expressions as a couple of other people have suggested is simply a more structured way of doing what you're

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Nigel Rantor
Luke Dunn wrote: yes power towers are allowed right, okay, without coding it here's my thought. factorise the numbers you have but only allowing primes that exist in your digit set. then take that factorisation and turn any repeated runs of digits multiplied by themselves into power-towers

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Trip Technician
On 20 Feb, 15:39, Nigel Rantor wrote: > Trip Technician wrote: > > anyone interested in looking at the following problem. > > if you can give me a good reason why this is not homework I'd love to > hear it...I just don't see how this is a real problem. > > > > > > > we are trying to express number

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Trip Technician
On 20 Feb, 16:02, Paul Rubin wrote: > Trip Technician writes: > > I have a dim intuition that it could be done with a very clever bit of > > recursion, but the exact form so far eludes me. > > This sounds a little like a homework assignment, or maybe a challenge > yo

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread andrew cooke
this is a neat problem. here is what i would do: use generators that extend an input. a stream approach. the initial input would be the numbers themselves. [('1', 1),('2', 2),('3', 3)] those are (expression, value) pairs then an initial attempt at the next function would be to extend that li

Re: get most common number in a list with tolerance

2009-02-20 Thread Tim Rowe
2009/2/20 Astan Chee : > Hi, > I have a list that has a bunch of numbers in it and I want to get the most > common number that appears in the list. This is trivial because i can do a > max on each unique number. What I want to do is to have a tolerance to say > that each number is not quite unique

  1   2   >