Re: iterating through files

2009-02-20 Thread Marc 'BlackJack' Rintsch
On Thu, 19 Feb 2009 13:56:38 -0800, oamram wrote: > new to python. i have a directory with about 50 text file and i need to > iterate through them and get > line 7 to 11 from each file and write those lines into another file(one > file that will contain all lines). Untested: from __future__ impo

Re: Threading and tkinter

2009-02-20 Thread Hendrik van Rooyen
"gert" > Hope you do not mind ignoring part of answers, so I can figure out > more why things work the way they are. > This two examples work, what i do not understand is that in function > display i do not have to declare root, v or x ? > x is easy - it was declared outside, in module scope,

Re: Will multithreading make python less popular?

2009-02-20 Thread Hendrik van Rooyen
"Steve Holden" wrote: > Perhaps it's time Python stopped being a dictatorship? This will need a wholesale switch to the worship of Freya - It is rumoured that She is capable of herding cats. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

email varification using smtplib or any method

2009-02-20 Thread jitendra gupta
hello here is my code for sending the mail, using this code email is going 'CODE '' import smtplib from time import strftime from email.mime.multipart

get most common number in a list with tolerance

2009-02-20 Thread 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 and if the difference from o

Re: Will multithreading make python less popular?

2009-02-20 Thread rushenaly
On 20 Şubat, 01:20, Paul Rubin wrote: > I would say, slow execution is a drawback that we put up with in order > to gain benefits of Python programming that are mostly unrelated to > the causes of the slowness.  The slowness itself can be addressed by > technical mea

Re: get most common number in a list with tolerance

2009-02-20 Thread Gerard Flanagan
Astan Chee wrote: 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 and if the

Re: Will multithreading make python less popular?

2009-02-20 Thread sturlamolden
On Feb 20, 12:19 am, Mensanator wrote: > What am I actually seeing? If Python only uses one of the cores, > why do both light up? Because of OS scheduling. You have more than one process running. The Python process does not stay on one core. Try to put CPython into a tight loop ("while 1: pass")

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

2009-02-20 Thread Nick Craig-Wood
Linuxguy123 wrote: > How do I do this in Python ? > > # > declare A,B > > function getA > return A > > function getB > return B > > function setA(value) > A = value > > function setB(value) > B = value > > main() > getA > ge

Re: email varification using smtplib or any method

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 02:58:24 -0200, jitendra gupta escribió: when i am changing msg['To'] = "wrongu...@wrongdomain.comddsdjsdsdsjdh" some wrong email then i am getting back failure notice in my inbox, which i dont want.. is there any way so that i can identify wrong email during the run ti

Re: Strange array.array performance

2009-02-20 Thread Maxim Khitrov
On Fri, Feb 20, 2009 at 2:42 AM, Scott David Daniels wrote: > Maxim Khitrov wrote: >> >> ... Here's the function that I'll be using from now on. It gives me >> exactly the behavior I need, with an int initializer being treated as >> array size. Still not as efficient as it could be if supported >>

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
Matimus wrote: On Feb 19, 8:06 pm, "W. eWatson" wrote: I'm using IDLE for editing, but execute programs directly. If there are execution or "compile" errors, the console closes before I can see what it contains. How do I prevent that? -- W. eWatson

Re: Regular expression bug?

2009-02-20 Thread Lie Ryan
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 split a CamelCase string into its constituent >> > components. >> >> How about >> >> >>> re.compile("[A-Za-z][a-z]*").findall("fooBarBaz")

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

2009-02-20 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : (snip) Note that in python we don't normally bother with getA/setA normally, just use self.A, eg class Stuff(object): def __init__(self): self.A = None self.B = None def main(self): print self.A print self.B # dosomething

import bug?

2009-02-20 Thread alain
Hi all, Running python 2.5, i experience a strange behaviour with the following code:import imputil def handle_pye(fullpath, fileinfo, name): # Print a debugging message print 'Importing "%s" from "%s"' % (name,fullpath) data = open(fullpath).read() return 0, compile(data,fullpath

Re: Keeping the Console Open with IDLE

2009-02-20 Thread David Smith
W. eWatson wrote: > Matimus wrote: >> On Feb 19, 8:06 pm, "W. eWatson" wrote: >>> I'm using IDLE for editing, but execute programs directly. If there are >>> execution or "compile" errors, the console closes before I can see >>> what it >>> contains. How do I prevent that? >>> -- >>>

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Brian Blais
On Feb 19, 2009, at 23:06 , W. eWatson wrote: I'm using IDLE for editing, but execute programs directly. Is there a reason you are executing them directly? Why not just run the script from IDLE with Run/Run Module (F5) until you are sure there are no errors? You can follow the advice alr

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
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 command prompt window (w/o the single quote characters)

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Catherine Heathcote
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 command prompt window (w/o the single

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
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 command prompt window (w/o the single

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2.3 as the book is about to go to press, 2004. I thought IDLE came bundled with Python.

FTP libs for Python?

2009-02-20 Thread Thomas Allen
I'm interested in writing a script to ease deployment of minor changes on some websites here, and it would involve some SFTP transfers. Do you know of good alternatives to ftplib, which is relatively low- level? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2.3 as the book is about to go to press, 2004. I thought IDLE came

Framework installation of 2.6 on OS X, with specified prefix

2009-02-20 Thread Evert Rol
Hi, 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 into /Applications, instead of eg

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

2009-02-20 Thread Trip Technician
anyone interested in looking at the following problem. we are trying to express numbers as minimal expressions using only the digits one two and three, with conventional arithmetic. so for instance 33 = 2^(3+2)+1 = 3^3+(3*2) are both minimal, using 4 digits but 33 = ((3+2)*2+1)*3 using 5 is no

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
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. Type 'cd ' (as in Change Directory) in the command p

Re: Newbie request assistance....Python - PAMIE - Java

2009-02-20 Thread coldpizza
This is not a Pamie issue. Pamie can only see the HTML part of the page. Any object embedded in the page using the or tags is not accessible to the browser, and the browser has no idea what is inside those objects - it simply passes control to the corresponding plugin, such as Java, Flash, Active

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Catherine Heathcote
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. Type 'cd ' (as in Change Direct

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

2009-02-20 Thread Ben Kaplan
On Feb 20, 2009, at 9:30 AM, Evert Rol wrote: Hi, 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

Re: FTP libs for Python?

2009-02-20 Thread coldpizza
Why don't you just use Curl? It does a dozen of protocols including SFTP. And if the command line version is not enough for you then there are Python bindings for Curl. On Feb 20, 4:22 pm, Thomas Allen wrote: > I'm interested in writing a script to ease deployment of minor changes > on some websi

Re: Will multithreading make python less popular?

2009-02-20 Thread Mensanator
On Feb 20, 4:36�am, sturlamolden wrote: > On Feb 20, 12:19 am, Mensanator wrote: > > > What am I actually seeing? If Python only uses one of the cores, > > why do both light up? > > Because of OS scheduling. You have more than one process running. The > Python process does not stay on one core. T

Re: FTP libs for Python?

2009-02-20 Thread Mike Kent
I use Fabric (http://www.nongnu.org/fab/) as my Python-based deployment tool, but it uses ssh/scp, not sftp. -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP libs for Python?

2009-02-20 Thread Jean-Paul Calderone
On Fri, 20 Feb 2009 06:22:29 -0800 (PST), Thomas Allen wrote: I'm interested in writing a script to ease deployment of minor changes on some websites here, and it would involve some SFTP transfers. Do you know of good alternatives to ftplib, which is relatively low- level? Twisted includes FT

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 12:29:35 -0200, W. eWatson escribió: Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2

Running script in module initialization

2009-02-20 Thread Kom2
Hello, I'm trying to convert my project from python 2.5 to python 3.0 and I have the following problem. My project is PYD library written in C++. So I have this PyInit_ModuleName function containing PyModule_Create call and this function also call some script with declarations: PyObject* m;

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

2009-02-20 Thread Paddy O'Loughlin
2009/2/20 Bruno Desthuilliers : > Note that while you *can* do direct access to the implementation attribute > (here, '_A' for property 'A'), you don't *need* to so (and usually shouldn't > - unless you have a very compelling reason). Interesting. Why shouldn't you? I haven't used the property() f

Re: FTP libs for Python?

2009-02-20 Thread Thomas Allen
On Feb 20, 9:45 am, coldpizza wrote: > Why don't you just use Curl? It does a dozen of protocols including > SFTP. And if the command line version is not enough for you then there > are Python bindings for Curl. I'm actually hoping to eventually package these tools using py2exe for some co-worker

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

2009-02-20 Thread Vincent Davis
Having looked long at this how does the prime factorization play into this. I would consider an approach similar to factoring a number. Of course the issue with prime factoring is your ned to know the primes. I assume this would be a similar problem you may need to know the solutions to the factors

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 12:39:14 -0200, W. eWatson escribió: Catherine Heathcote wrote: you need to open a dos prompt before doing the steps above. Go to start->run and hit "cmd" without the quotes. Something is amiss here. There's the MS Command Prompt, which I'm looking at right now. Yes,

Re: Running script in module initialization

2009-02-20 Thread Steve Holden
Kom2 wrote: > Hello, > I'm trying to convert my project from python 2.5 to python 3.0 and I > have the following problem. My project is PYD library written in C++. > So I have this PyInit_ModuleName function containing PyModule_Create > call and this function also call some script with declarations

Re: FTP libs for Python?

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 13:24:37 -0200, Thomas Allen escribió: On Feb 20, 9:45 am, coldpizza wrote: Why don't you just use Curl? It does a dozen of protocols including SFTP. And if the command line version is not enough for you then there are Python bindings for Curl. I'm actually hoping to e

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
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: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:29:35 -0200, W. eWatson escribió: Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python t

Re: Keeping the Console Open with IDLE

2009-02-20 Thread David Smith
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 command prompt wi

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Catherine Heathcote
W. eWatson wrote: 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 Win

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

2009-02-20 Thread Luke Dunn
I am teaching myself coding. No university or school, so i guess its homework if you like. i am interested in algorithms generally, after doing some of Project Euler. Of course my own learning process is best served by just getting on with it but sometimes you will do that while other times you mig

Re: Matplotlib change xticks and retain xticks changing during zoom

2009-02-20 Thread Robert Kern
You will probably get better help on the matplotlib mailing list: https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though i

Re: matplotlib issue: cannot auto-scale X axis of plop properly

2009-02-20 Thread Robert Kern
On 2009-02-19 19:22, Nash, Brent R wrote: Hey everyone, I'm fairly new to matplotlib, but have read through tons of the documentation today and have a decent understanding of it. All the auto-scaling, xlim, and x_bound stuff works fine for me with the examples, but as soon as I try to use it on

Re: Keeping the Console Open with IDLE

2009-02-20 Thread W. eWatson
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 command prompt windo

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

2009-02-20 Thread Luke Dunn
yes power towers are allowed exponentiation, multiplication, division, addition and subtraction. Brackets when necessary but length is sorted on number of digits not number of operators plus digits. I always try my homework myself first. in 38 years of life I've learned only to do what i want, if

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 : Note that while you *can* do direct access to the implementation attribute (here, '_A' for property 'A'), you don't *need* to so (and usually shouldn't - unless you have a very compelling reason). Interesting. Why shouldn't you? I have

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

2009-02-20 Thread Nigel Rantor
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 numbers as minimal expressions using only the digits one two an

Re: Keeping the Console Open with IDLE

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 13:37:06 -0200, W. eWatson escribió: Catherine Heathcote wrote: W. eWatson wrote: Run the program from within the MS command line, not by double clicking it. Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS commands. I get to drill my way down 4

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

2009-02-20 Thread Paul Rubin
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 you are trying to solve for yourself, rather than be given a complete answer for

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

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: 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 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 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 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

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

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"

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

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

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: 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

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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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.

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

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: 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(

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: 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: 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

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 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

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: 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: 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: 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: 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: 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: 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: 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 א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه

  1   2   >