Re: problem using import from PyRun_String

2008-04-09 Thread Gabriel Genellina
En Tue, 08 Apr 2008 22:01:18 -0300, Patrick Stinson <[EMAIL PROTECTED]> escribió: > I'm creating a module with PyModule_New(), and running a string buffer as > the module's text using PyRun_String and passing the module's __dict__ to > locals and globals. Why? Do you want to fake what import do

Re: makepy.py not working

2008-04-09 Thread suzhi18
Ok, thanks for your help. After looking into the makepy.py file it was clear that this is only a command for the CMD console. I want to write a function which generates this .py file of the excel objects. I will now send the command to the CMD threw my python code. thanks again. suzhi -- http:/

Re: makepy.py not working

2008-04-09 Thread suzhi18
Ok, thanks for your help. After looking into the makepy.py file it was clear that this is only a command for the CMD console. I want to write a function which generates this .py file of the excel objects. I will now send the command to the CMD threw my python code. thanks again. suzhi -- http:/

Re: set file permission on windows

2008-04-09 Thread Gabriel Genellina
En Tue, 08 Apr 2008 14:03:06 -0300, Tim Arnold <[EMAIL PROTECTED]> escribió: > hi, I need to set file permissions on some directory trees in windows > using > Python. The hard way: Use the function SetFileSecurity, the pywin32 package exposes it. See the Microsoft documentation at http://

Re: Converting a tuple to a list

2008-04-09 Thread Carl Banks
On Apr 8, 6:46 pm, "Gabriel Ibanez" <[EMAIL PROTECTED]> wrote: > Gabriel Ibanez wrote: > > Hi all .. > > > I'm trying to using the map function to convert a tuple to a list, without > > success. > > > I would like to have a lonely line that performs the same as loop of the > > next script: > > > --

Re: Sorting a List of Objects by an Attribute of the Objects Case-Insensitively

2008-04-09 Thread Peter Otten
Paddy wrote: > On Apr 9, 4:04 am, Jason <[EMAIL PROTECTED]> wrote: >> Hi folks-- >> >> Basically, I have a pressing need for a combination of 5.2 "Sorting a >> List of Strings Case-Insensitively" & 5.3 "Sorting a List of Objects >> by an Attribute of the Objects" from the Python Cookbook. >> >> My

Re: makepy.py not working

2008-04-09 Thread suzhi18
Ok, thanks for your help. After looking into the makepy.py file it was clear that this is only a command for the CMD console. I want to write a function which generates this .py file of the excel objects. I will now send the command to the CMD threw my python code. thanks again. suzhi -- http:/

Re: Can't figure out traceback: (error_proto(-ERR EOF) line 121 poplib.py

2008-04-09 Thread Gabriel Genellina
En Wed, 09 Apr 2008 02:19:47 -0300, erikcw <[EMAIL PROTECTED]> escribió: > I keep getting this error from poplib: > (error_proto(-ERR EOF) line 121 poplib.py > > Does this mean the connection has timed out? What can I do to deal > with it? If it happens from time to time, just wait a few minut

Re: Setting default version among multiple python installations

2008-04-09 Thread Gabriel Genellina
En Wed, 09 Apr 2008 02:45:28 -0300, Karthik <[EMAIL PROTECTED]> escribió: > if i type python2.5 i am able to use the latest python, but if i simply > type python it taken me to the older version. (it is a minor annoyance, > but I want to know how to fix it) From the README file: Ther

Re: Cannot understand the detailedly the following code

2008-04-09 Thread reachmsn
On Apr 8, 5:45 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-04-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > [deleted a long piece of text by our BDFL about recursive graph path-finding > algorithm] > > > after first writing the inductive part ... for node in > > graph[start]

PyArg_ParseTuple for structs or binary data

2008-04-09 Thread Alvin Delagon
Hello fellow pythonistas, I'm currently writing a simple python SCTP module in C. So far it works sending and receiving strings from it. The C sctp function sctp_sendmsg() has been wrapped and my function looks like this: sendMessage(PyObject *self, PyObject *args) { const char *msg = ""; if

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread subhabrata . iisc
Dear Sir, Thank you for taking time out to answer. For (i) It is happening. On trial it ran so well that when on demonstration I got questions from tester, I felt amazed. For (ii) For answer no.2 I'll check str.find. For (iii) Well I said you most of crawler's algorithm. It works like a MS IE synch

Re: Setting default version among multiple python installations

2008-04-09 Thread Karthik
Gabriel Genellina wrote: En Wed, 09 Apr 2008 02:45:28 -0300, Karthik <[EMAIL PROTECTED]> escribió: if i type python2.5 i am able to use the latest python, but if i simply type python it taken me to the older version. (it is a minor annoyance, but I want to know how to fix it) From

Re: Cannot understand the detailedly the following code

2008-04-09 Thread reachmsn
On Apr 8, 5:45 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-04-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > [deleted a long piece of text by our BDFL about recursive graph path-finding > algorithm] > > > after first writing the inductive part ... for node in > > graph[start]

Re: Google App Engine

2008-04-09 Thread Duncan Booth
Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Apr 8, 7:50 pm, John Nagle <[EMAIL PROTECTED]> wrote: >> Duncan Booth wrote: >> > Google have announced a new service called 'Google App Engine' >> > which may be of interest to some of the people here >> >> OK, now we need a compatibility layer s

Re: Coping with cyclic imports

2008-04-09 Thread Torsten Bronger
Hallöchen! Jeffrey Froman writes: > [...] > > Cyclic imports are not a problem by themselves, but cyclic > definitions are. Thus: > > # a.py > import b > x = 1 > > # b.py > import a > x = 2 > > works fine, but: > > # a.py > import b

Re: Can C.L.P.handle the load?

2008-04-09 Thread Berco Beute
On Apr 9, 7:54 am, Paddy <[EMAIL PROTECTED]> wrote: > What else could we do to make c.l.p. of more use to the newbie whp may > also be new to usenet whilst keeping c.l.p a usefull place for all? > > - Paddy. Maybe create a usenet/google group for newbies? A place to ask beginners questions. And po

Application of "with" statement in py3k. Property defining/redefining.

2008-04-09 Thread Zaur Shibzoukhov
http://szport.blogspot.com/2008/04/application-of-with-statement-in-py3k.html -- http://mail.python.org/mailman/listinfo/python-list

Is Leo better than Vim and emacs?

2008-04-09 Thread wang frank
Hi, Thanks for developing Leo. I have been using Vim for long time to write code. Is it a good time to switch to Leo? what is the advantage of Leo against vim and emacs? Thanks Frank _ マイクロソフトの最新次世代ブラウザIE7にMSN版ならではの便利な機能をプラス

Very good Python Book. Free download : Beginning Python: From Novice to Professional

2008-04-09 Thread hassan nikbakhsh
can i have a free bownload of this book many thanks - You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.-- http://mail.python.org/mailman/listinfo/python-list

Basic optimization of python.

2008-04-09 Thread 甜瓜
Howdy, I wonder whether python compiler does basic optimizations to .py. Eg: t = self.a.b t.c = ... t.d = ... .vs. self.a.b.c = ... self.a.b.d = ... which one is more effective? Since each dot invokes a hash table lookup, it may be time consuming. If the compiler can do expression folding, then

Re: Data structure recommendation?

2008-04-09 Thread Steven Clark
> > I believe the best way to implement this would be a binary search > > (bisect?) on the actual times, which would be O(log N). Though since > > they are timestamps they should be monotonically increasing, in which > > case at least you don't have to go to the expense of sorting them. > > > > "So

wxPython scrolling question.

2008-04-09 Thread Steven W. Orr
I just discovered Accelerator entries so my wx app is now able to exit by typing Ctrl-Q. Can someone please tell me what to use to cause a pane to scroll up and down using the middle mouse scroll roller thingy? I looked and found wxCURSOR_MIDDLE_BUTTON but I suspect that's only good for clickin

Re: Coping with cyclic imports

2008-04-09 Thread Duncan Booth
Torsten Bronger <[EMAIL PROTECTED]> wrote: > So, the last question is: Under which circumstances does this > happen? It happens when you import a module which imports (directly > or indictly) the current module and which comes before the current > module in the import order while the program runs

what's the reasonale of loghelper() in mathmodule.c

2008-04-09 Thread rockins
Hi all, I downloaded Python-2.5.2.tar.bz2 and want to lean some math function implementation in it. I found that mathmodule.c implements 'math' module of python. In this file there's a function loghelper()(in Python-2.5.2/Modules/mathmodule.c), it seems with this function's help any base logarithm

Need Help

2008-04-09 Thread pramod sridhar
Hello, I would like to access type library files (.tlb) from python. The application (with .tlb extension) controls an external instrument over standard GPIB interface. Is it possible to control this application from Python? If so, how ? Can anyone share or send link of some examples ? Many Than

Re: Can C.L.P.handle the load?

2008-04-09 Thread Duncan Booth
Berco Beute <[EMAIL PROTECTED]> wrote: > On Apr 9, 7:54 am, Paddy <[EMAIL PROTECTED]> wrote: >> What else could we do to make c.l.p. of more use to the newbie whp may >> also be new to usenet whilst keeping c.l.p a usefull place for all? >> >> - Paddy. > > Maybe create a usenet/google group for n

ProxyHandler doesn't completly hide your identity?

2008-04-09 Thread Lamonte Harris
Is it still possible to detect who you are under a proxy when using urllib2? -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic optimization of python.

2008-04-09 Thread Diez B. Roggisch
甜瓜 wrote: > Howdy, > I wonder whether python compiler does basic optimizations to .py. > Eg: > t = self.a.b > t.c = ... > t.d = ... > .vs. > self.a.b.c = ... > self.a.b.d = ... > which one is more effective? Since each dot invokes a hash table lookup, > it may be time consuming. If the compile

Re: Basic optimization of python.

2008-04-09 Thread [EMAIL PROTECTED]
On Apr 7, 7:30 am, "甜瓜" <[EMAIL PROTECTED]> wrote: > Howdy, > I wonder whether python compiler does basic optimizations to .py. > Eg: > t = self.a.b > t.c = ... > t.d = ... > .vs. > self.a.b.c = ... > self.a.b.d = ... > which one is more effective? Since each dot invokes a hash table lookup, it

Re: expanding a variable to a dict

2008-04-09 Thread Max M
John Machin skrev: > On Apr 4, 9:44 am, Max M <[EMAIL PROTECTED]> wrote: > Ummm ... excessive apostrophes plus bonus gross syntax error, dood. > Did you try running any of these snippets??? No I just wanted to quickly show different ways to do it. The dicts in the original question wasn't dicts

I am worried about Python 3

2008-04-09 Thread jmDesktop
I am a new Python programmer. I have always desired to learn Python, but have never had the opportunity. Recently this has changed, and I have an opportunity to get away from the .NET framework. I found Django (and other web frameworks) and began my quest to learn. I started reading Dive Into P

Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional

2008-04-09 Thread Greg Lindstrom
> From: hassan nikbakhsh <[EMAIL PROTECTED]> > Subject: Very good Python Book. Free download : Beginning Python: From > Novice to Professional > can i have a free bownload of this book > many thanks > Yes, it's a very good book. Magnus Lie Hetland spent a lot of time putting the book together; wh

Re: Basic optimization of python.

2008-04-09 Thread Hrvoje Niksic
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Eg: >> a = 1 + 2 >> .vs. >> a = 3 >> which one is more effective? Does the compiler calculate the result at >> compile time? How about constant spreading? > > Algebraic optimizations aren't done AFAIK Just try it: Python 2.5.1 (r251:54863, Oct 5

Re: Basic optimization of python.

2008-04-09 Thread Diez B. Roggisch
> This is safe, and is done: > import dis def f(): x = 1 + 2 > ... dis.dis(f) > 1 0 LOAD_CONST 3 (3) > 3 STORE_FAST 0 (x) > 6 LOAD_CONST 0 (None) > 9 RETURN_VALUE So I stand correct

Re: Basic optimization of python.

2008-04-09 Thread Diez B. Roggisch
Hrvoje Niksic wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >>> Eg: >>> a = 1 + 2 >>> .vs. >>> a = 3 >>> which one is more effective? Does the compiler calculate the result at >>> compile time? How about constant spreading? >> >> Algebraic optimizations aren't done AFAIK > > Just try

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > If you know anyone in Bangalore, India expert in python kindly > send him across I can show him the problem in my machine and Indian > Institute of Science(IISc-locally known as TATA INSTITUTE) is a > distinguished place.Any one should know it. > I am in no mood of

Re: is Pylons alive?

2008-04-09 Thread Gerhard Häring
Mage wrote: > Hello, > > I don't want to be impolite, just in short: I am thinking about leaving > RoR and coming back to Python. I've missed the last two years in Python, > however I have been subscribed to this list and there are not too many > e-mails about Pylons in my mailbox. Why don't y

is Pylons alive?

2008-04-09 Thread Mage
Hello, I don't want to be impolite, just in short: I am thinking about leaving RoR and coming back to Python. I've missed the last two years in Python, however I have been subscribed to this list and there are not too many e-mails about Pylons in my mailbox. On my Gentoo the latest

Re: text adventure game problem

2008-04-09 Thread corvettecraz92
On Apr 9, 1:24 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 8 Apr 2008 18:01:01 -0700 (PDT), [EMAIL PROTECTED] > declaimed the following in comp.lang.python: > > > okay, I'm having this one problem with a text adventure game. It's > > kind of hard to explain, but I'll do my best. > >

Re: is Pylons alive?

2008-04-09 Thread Jarek Zgoda
Mage napisał(a): > I don't want to be impolite, just in short: I am thinking about leaving > RoR and coming back to Python. I've missed the last two years in Python, > however I have been subscribed to this list and there are not too many > e-mails about Pylons in my mailbox. > > On my Gentoo the

Re: I am worried about Python 3

2008-04-09 Thread Marc 'BlackJack' Rintsch
On Wed, 09 Apr 2008 05:04:20 -0700, jmDesktop wrote: > If I continue in Python 2.5.x, am I making a mistake? Is it really > that different? No it's still Python and most things you've learned with 2.x stay the same. > Here is an excerpt that is causing me concern: > > Two new versions of the l

Re: I am worried about Python 3

2008-04-09 Thread Diez B. Roggisch
jmDesktop wrote: > I am a new Python programmer. I have always desired to learn Python, > but have never had the opportunity. Recently this has changed, and I > have an opportunity to get away from the .NET framework. I found > Django (and other web frameworks) and began my quest to learn. I >

Re: Google App Engine

2008-04-09 Thread Duncan Booth
Duncan Booth <[EMAIL PROTECTED]> wrote: > If you use authentication then again you are tied to Google accounts (or > Google Apps accounts). For a public application that would also block > attempts to move to another platform. Correcting myself: according to http://code.google.com/p/googleappe

Re: what's the reasonale of loghelper() in mathmodule.c

2008-04-09 Thread Mark Dickinson
On Apr 9, 4:38 am, rockins <[EMAIL PROTECTED]> wrote: > I cannot understand it well, can anyone explain me why and how > loghelper() can compute any base logarithm? Or could anyone give me > some reference(such as, books or papers)? loghelper is there so that log(n) can be computed for any positiv

String manipulation questions

2008-04-09 Thread goldtech
Hi, Replacing strings in a text (likely an XML) file. Some newbie questions... ... while line: counter=counter+1 if line.find(newstring) != -1: print 'match at line'+str(counter) newline = line.replace(oldstring, newstring) fileOUT.write(newline) line=fileIN.readline()

Re: List open files

2008-04-09 Thread Bruno GUERPILLON
"Guillaume" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Oh and don't forget to take care about saving correctly the Oracle > database ! ^^ > (private joke *giggles* j/k :)) > > Regards, > -- > Guillaume Sure Guillamne and dont forget to answer the right questions

Re: I am worried about Python 3

2008-04-09 Thread Mike Driscoll
On Apr 9, 7:04 am, jmDesktop <[EMAIL PROTECTED]> wrote: > I am a new Python programmer. I have always desired to learn Python, > but have never had the opportunity. Recently this has changed, and I > have an opportunity to get away from the .NET framework. I found > Django (and other web framewo

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread subhabrata . iisc
Hi Steve, comp.lang.python is supposed to be a serious group not anyone knowing nothing and giving comment. Well, original code snippet I don't know why an expert person like you fails to understand, I told it almost can't you guess the next portion? Tough indeed, then. I've to take permission from

Re: __init__.py file

2008-04-09 Thread Jeffrey Barish
cesco wrote: > I need to instantiate an object (my_object) whose methods I have to > use in two files (file1.py and file2.py) which are in the same > directory. Is it possible to instantiate such object in the > __init__.py file and then directly use it in file1.py and file2.py? > If not, as I seem

Re: String manipulation questions

2008-04-09 Thread Duncan Booth
goldtech <[EMAIL PROTECTED]> wrote: > Question1: The replace method - If a string does not have the target > replacement "newstring", then newline equals oldstring? Ie. oldstring > is not changed in any way? Seems to be what I observe but just want to > confirm this. Yes. > > Question2: I'm us

Re: Basic optimization of python.

2008-04-09 Thread bearophileHUGS
ShenLei: > t = self.a.b > t.c = ... > t.d = ... > .vs. > self.a.b.c = ... > self.a.b.d = ... > which one is more effective? Since each dot invokes a hash table lookup, it > may be time consuming. If the compiler can do expression folding, then no > manual folding is needed. Removing dots creatin

Re: I am worried about Python 3

2008-04-09 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > There will be a `2to3.py` program coming with Python 2.6 that tries to > convert most changes automatically. You may have to change the 2.6 code > in a way that makes the automatic conversion possible but it i

Re: CPython VM & byte code resources wanted

2008-04-09 Thread Steve Holden
Steve Holden wrote: > Aaron Gray wrote: >> "Aaron Gray" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Hi, >>> >>> I am looking to study the CPython source code, but I cannot seem to find >>> the VM code. >> Found it :) >> >> Python/ceval.c >> >>> Also is there any whe

Re: I am worried about Python 3

2008-04-09 Thread Steve Holden
Mike Driscoll wrote: > On Apr 9, 7:04 am, jmDesktop <[EMAIL PROTECTED]> wrote: >> I am a new Python programmer. I have always desired to learn Python, >> but have never had the opportunity. Recently this has changed, and I >> have an opportunity to get away from the .NET framework. I found >> Dj

argument to python cgi script

2008-04-09 Thread syed mehdi
Hi Guys, If someone can help me in telling how can i pass arguments to python cgi script then that will be good. like if i want to pass "some argument" to my remote python script, by calling something like: http://localhost/cgi-bin/test.py?some\ argument. What is the correct way of sending argument

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread Gabriel Genellina
On 9 abr, 10:27, [EMAIL PROTECTED] wrote: > comp.lang.python is supposed to be a serious group not anyone knowing > nothing and giving comment. Anyone is welcome to post in this group - from beginners to gurus, and that's a very good thing. All people here is usually very kind and helpful, and th

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > Thanks. I apparently am printing some holder for the image. I stripped > > out > > most of it with this > > content[0][0] > > but then I am left with this: > > > > array('c', '\xff\xd8\xff\xe0\\0\x10JFI...) > > How do

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I thought if you know then only you can help. I am waiting for a > knowledgeable answer from a knowledgeable person. I think I can show a ALL the answers you got here so far indicate that you did NOT give enough details to actually answer the question. Moreover, you cla

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > <[EMAIL PROTECTED] > wrote: > > > Thanks. I apparently am printing some holder for the image. I > stripped > > out > > most of it with this > > content[0][0] > > but

Re: Basic optimization of python.

2008-04-09 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > >> Eg: > >> a = 1 + 2 > >> .vs. > >> a = 3 > >> which one is more effective? Does the compiler calculate the result at > >> compile time? How about constant spreading? >

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > > <[EMAIL PROTECTED] > wrote: > > Now all you have to do is what I told you in the first place, which is > to remove

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread Steve Holden
Diez B. Roggisch wrote: [...] > And then come back and post self-contained examples of whatever behavior you > observe, and this community will be as helpful as it is. But we can't read > sense in anything you posted so far, despite the best efforts. So unless > that changes, you won't be helped he

Re: import statement convention

2008-04-09 Thread MartinRinehart
Thanks, all. Good to know no one's been beheaded. Yes to separating test and non-test code, but no if that will just turn one modest module into two modules, smaller still. Amen to 'practicality beats purity.' Do wish we had a good, thorough convention set. I wrote one for Java. It took a lot o

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > > <[EMAIL PROTECTED] >

Re: Cannot understand the detailedly the following code

2008-04-09 Thread A.T.Hofkamp
On 2008-04-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Apr 8, 5:45 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > Ok following these instructions one gets > > def find_all_paths(graph, start, end, path=[]): > path= path+ [start] > > for node in graph[start]: > >find_all_paths(graph

Re: import statement convention

2008-04-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Thanks, all. > > Good to know no one's been beheaded. > > Yes to separating test and non-test code, but no if that will just > turn one modest module into two modules, smaller still. > > Amen to 'practicality beats purity.' > > Do wish we had a good, thorough conventi

Trouble with list comprehension

2008-04-09 Thread Shane Lillie
I've got a bit of code that looks like this: for i in xrange(1000): # shuffle the doors doors = [ 'G', 'C', 'G' ] random.shuffle(doors) # save the doors that have goats (by index) goats = [ x for x in range(2) if doors[x] == 'G' ] but for some reason the list comprehension is

Re: String manipulation questions

2008-04-09 Thread goldtech
snip... > >for counter, line in enumerate(fileIN): >newline = line.replace(oldstring, newstring) >if newline != line: >print 'match at line', counter+1 >fileOUT.write(newline) "enumerate" - haven't seen that before. Nice! Thanks -- http://mail.python.org/m

Re: Trouble with list comprehension

2008-04-09 Thread Jeffrey Froman
Shane Lillie wrote: > goats = [ x for x in range(2) if doors[x] == 'G' ] > > but for some reason the list comprehension is not always returning a > list with 2 elements in it (sometimes it will be just 1 element). The problem here is with your usage of the range() function. You provide an endpoi

Re: I am worried about Python 3

2008-04-09 Thread John Nagle
jmDesktop wrote: > If I continue in Python 2.5.x, am I making a mistake? Is it really > that different? No. It may never happen, either. The Perl crowd tried something like this, Perl 6, which was announced in 2000 and still hasn't come out. The C++ standards committee has been working on

Re: Trouble with list comprehension

2008-04-09 Thread Gary Herron
Shane Lillie wrote: > I've got a bit of code that looks like this: > > for i in xrange(1000): > # shuffle the doors > doors = [ 'G', 'C', 'G' ] > random.shuffle(doors) > > # save the doors that have goats (by index) > goats = [ x for x in range(2) if doors[x] == 'G' ] > Usin

Re: Trouble with list comprehension

2008-04-09 Thread Steve Holden
Shane Lillie wrote: > I've got a bit of code that looks like this: > > for i in xrange(1000): > # shuffle the doors > doors = [ 'G', 'C', 'G' ] > random.shuffle(doors) > > # save the doors that have goats (by index) > goats = [ x for x in range(2) if doors[x] == 'G' ] > > but

Stani's python ide 'spe' editor problem

2008-04-09 Thread Rick King
Hi everyone, The editor in spe on my system (win XP home sp2) does not do automatic indentation. I can't figure out why - it used to. I'm set up with subversion so I have the very latest stuff from Stani. It's amazing how not having automatic indentation can make working in the ide such a pa

Re: How to find documentation about methods etc. for iterators

2008-04-09 Thread Arnaud Delobelle
On Apr 9, 5:05 pm, [EMAIL PROTECTED] wrote: > I'm not sure if I have even phrased that right but anyway > > How does one find (in the standard Python documentation) information > about things like the iteritems() method and the enumerate() function. > > They are mentioned in the tutorial as way

Stani's python ide 'spe' editor problem (again)

2008-04-09 Thread Rick King
In my previous post about spe I didn't mention that my set up is: python 2.4.4 wxpython 2.8.3 thanks. -Rick King -- http://mail.python.org/mailman/listinfo/python-list

Re: problem using import from PyRun_String

2008-04-09 Thread Patrick Stinson
Well, I eventually want to add an import hook, but for now I'd rather just get the import statement working normally again. I have embedded python as a scripting engine in my application. To do this, I create a new empty module, run the script text using PyRun_String() passing the module's __dict__

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > connection = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) > > cursor = connection.

Re: I am worried about Python 3

2008-04-09 Thread Christian Heimes
jmDesktop schrieb: > If I continue in Python 2.5.x, am I making a mistake? Is it really > that different? I'm speaking as a long time Python user and Python core developer here. You are safe to ignore Python 3.0 for now. :] You can start worrying about the 3.x series in 2010 when Python 3.1 is o

How to find documentation about methods etc. for iterators

2008-04-09 Thread tinnews
I'm not sure if I have even phrased that right but anyway How does one find (in the standard Python documentation) information about things like the iteritems() method and the enumerate() function. They are mentioned in the tutorial as ways of getting more information as you loop through an o

Re: I am worried about Python 3

2008-04-09 Thread Istvan Albert
On Apr 9, 11:53 am, John Nagle <[EMAIL PROTECTED]> wrote: > The general consensus is that Python 3.x isn't much of an there are a number of unfortunate typos in there that interfere with the message, instead of "The general consensus is" I think you actually meant "In my opinion" i. -- ht

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden > <[EMAIL PROTECTED] >

Re: set file permission on windows

2008-04-09 Thread Tim Arnold
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold wrote: >> "Mike Driscoll" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> On Apr 8, 12:03 pm, "Tim Arnold" <[EMAIL PROTECTED]> wrote: >> >>> According to the following thread, you can

Re: question about string formatting

2008-04-09 Thread G
>>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'en_US.UTF-8' >>> locale.format('%.2f', 1021212.12, True) '1,021,212.12' >>> On Wed, Apr 9, 2008 at 1:04 PM, Kelie <[EMAIL PROTECTED]> wrote: > Hello, > > Is there something in Python built-in function or library that will > convert a numb

Guppy-PE / Heapy 0.1.8

2008-04-09 Thread Sverker Nilsson
I am happy to announce Guppy-PE 0.1.8 Guppy-PE is a library and programming environment for Python, currently providing in particular the Heapy subsystem, which supports object and heap memory sizing, profiling and debugging. It also includes a prototypical specification language, the Guppy Specif

Re: Learning curve for new database program with Python?

2008-04-09 Thread M.-A. Lemburg
On 2008-04-07 20:19, Gary Duzan wrote: > In article <[EMAIL PROTECTED]>, > M.-A. Lemburg <[EMAIL PROTECTED]> wrote: >> On 2008-04-07 15:30, Greg Lindstrom wrote: >>> SQL is one of the areas I wish I had mastered (much) earlier in my career >> Fully agree :-) >> >> Interesting comments in a time whe

Re: is Pylons alive?

2008-04-09 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Gerhard Häring <[EMAIL PROTECTED]> wrote: > - TurboGears 2.0 (I personally wouldn't bother with TurboGears 1.x at > this point) Having investigated some of this myself recently, I agree with you that the TG 1.x series is a dead end, but there's no TG 2.0 yet. La

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > > > I'm having a problem believing this, but I don't think you are lying. > Are you *sure* you ha

question about string formatting

2008-04-09 Thread Kelie
Hello, Is there something in Python built-in function or library that will convert a number 1205466.654 to $1,205,466.65? To add the "$" sign and set the decimal place is not a problem, but I don't know how to add the thousands delimiter. Thanks, -- Kelie UliPad

Re: question about string formatting

2008-04-09 Thread Jerry Hill
On Wed, Apr 9, 2008 at 1:04 PM, Kelie <[EMAIL PROTECTED]> wrote: > Is there something in Python built-in function or library that will convert > a number 1205466.654 to $1,205,466.65? To add the "$" sign and set the > decimal place is not a problem, but I don't know how to add the thousands > delim

Re: Python Leopard DLL Hell

2008-04-09 Thread Brian Cole
I have learned that this is a specific behavior of OS X. I have submitted a formal bug report to Apple about the problem. It appears that this is documented by Apple as acceptable: http://developer.apple.com/documentation/DeveloperTools/Reference/MachOReference/Reference/reference.html#//apple_ref/

Re: question about string formatting

2008-04-09 Thread Kelie
Thank you Jerry! -- Kelie UliPad is my Python editor. -- http://mail.python.org/mailman/listinfo/python-list

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi Steve, > comp.lang.python is supposed to be a serious group not anyone knowing > nothing and giving comment. Well, original code snippet I don't know > why an expert person like you fails to understand, I told it almost > can't you guess the next portion? And this

Re: Google App Engine

2008-04-09 Thread Erich
On Apr 9, 3:51 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > The backend data store, while it has a vaguely SQLish query language is an > object database not a relational database, i.e. more like ZODB than MySQL. > It uses similar concepts to django's data api but isn't the same. It should > be po

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden > <[EMAIL PROTECTED] >

Parsing locale specific dates, currency, numbers

2008-04-09 Thread Malcolm Greene
The locale module provides the ability to format dates, currency and numbers according to a specific locale. Is there a corresponding module for parsing locale's output to convert locale formatted dates, currency, and numbers back to their native data types on the basis of a specified locale? In

Pydev 1.3.15 Released

2008-04-09 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.15 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: --

Pydev shell (was: Re: Stani's python ide 'spe' editor problem)

2008-04-09 Thread Fabio Zadrozny
> Anyway, I am extremely frustrated. I've tried other ide's: pythonwin (I > found it inadequate for my purposes - why is a command line prompt > displayed in a dialog window?) - eclipse (editor is just ok, shell does > not have command history(!), and then *really* funky things started > happe

Re: Google App Engine

2008-04-09 Thread Daniel Fetchinson
> > > The backend data store, while it has a vaguely SQLish query language is an > > object database not a relational database, i.e. more like ZODB than MySQL. > > It uses similar concepts to django's data api but isn't the same. It > should > > be possible to write something simple to replace it,

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:49 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED] > > > wrote: > I imagine the following code should do so, given your earlier writings: > > #! /usr/bin/pyth

  1   2   >