Re: include statement

2006-09-19 Thread joakim . hove
Thanks to all who took time to answer! > > is it possible in python to include another python source file into the > > current namespace, i.e.completely analogous to the #include statement > > in C. [...] > Tell us why you are contemplating such a thing, and someone > here will help you impleme

Re: how to control file output encoding?

2006-09-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, MaTianyi wrote: > the encoding of file that is output by the file.write() function is > always None. > and the encoding attribute of the File Object is readonly. > > f = open('abc.txt','w') > print f.encoding None > > how can I change the file output encoding? Use

Re: byte count unicode string

2006-09-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, willie wrote: > # What's the correct way to get the > # byte count of a unicode (UTF-8) string? > # I couldn't find a builtin method > # and the following is memory inefficient. > > ustr = "example\xC2\x9D".decode('UTF-8') > > num_chars = len(ustr)# 8 > > buf = ustr.

Re: Tkinter on Python 2.4 on Mac OS X?

2006-09-19 Thread Ben Kovitz
Bill Williams wrote: > In article <[EMAIL PROTECTED]>, > "Ben Kovitz" <[EMAIL PROTECTED]> wrote: > > > Maybe this is a better question for me to ask: *How* did you get > > Python 2.4 running with Tkinter on OS X? > > I didn't do anything special to get Python 2.4 and Tkinter running on OS > 10.3.

Re: byte count unicode string

2006-09-19 Thread John Machin
willie wrote: > # What's the correct way to get the > # byte count of a unicode (UTF-8) string? > # I couldn't find a builtin method > # and the following is memory inefficient. > > ustr = "example\xC2\x9D".decode('UTF-8') > > num_chars = len(ustr)# 8 > > buf = ustr.encode('UTF-8') > > num_byte

One program in different GUI Toolkits

2006-09-19 Thread Franz Steinhaeusler
Hello NG, I have a suggestion. For simplifying learning or switching between different GUI Toolkits, I could imagine to have one short clearly presented program in different GUI Toolkits. What about for example wxProject? http://wiki.wxpython.org/index.cgi/WxProject or some other suggestion to

Re: include statement

2006-09-19 Thread MonkeeSage
[EMAIL PROTECTED] wrote: > Hello, > > is it possible in python to include another python source file into the > current namespace, i.e.completely analogous to the #include statement > in C. > > Regards Joakim from blah import * # where blah is a blah.py file in sys.path Also see: http://pyref.in

Re: include statement

2006-09-19 Thread Ravi Teja
> is it possible in python to include another python source file into the > current namespace, i.e.completely analogous to the #include statement > in C. By using a pre-processor, like C does. http://www.freenet.org.nz/python/pyp/ If you are new to Python, keep in mind that this is for special ca

Re: include statement

2006-09-19 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hello, > > is it possible in python to include another python source file into the > current namespace, i.e.completely analogous to the #include statement > in C. > > Regards Joakim > > No (thank heavens)! We left #include and other such primitive functionality back

Re: newbe's re question

2006-09-19 Thread MonkeeSage
Hi Eric, Don't let people offput you from learning python. It's a great language, and is fun to use. But really, George does have a point -- if you want to learn python, then the best way is to swim with the tide rather than against it. But still, don't worry too much about being pythonic and what

Re: how to control file output encoding?

2006-09-19 Thread Peter Otten
MaTianyi wrote: > the encoding of file that is output by the file.write() function is > always None. > and the encoding attribute of the File Object is readonly. > > f = open('abc.txt','w') > print f.encoding > >>> None > > how can I change the file output encoding? Have a look a the codecs

include statement

2006-09-19 Thread joakim . hove
Hello, is it possible in python to include another python source file into the current namespace, i.e.completely analogous to the #include statement in C. Regards Joakim -- http://mail.python.org/mailman/listinfo/python-list

byte count unicode string

2006-09-19 Thread willie
# What's the correct way to get the # byte count of a unicode (UTF-8) string? # I couldn't find a builtin method # and the following is memory inefficient. ustr = "example\xC2\x9D".decode('UTF-8') num_chars = len(ustr)# 8 buf = ustr.encode('UTF-8') num_bytes = len(buf) # 9 # Thanks.

Re: ANN: Python Molecular Viewer - 1.4.3

2006-09-19 Thread Niels L Ellegaard
[EMAIL PROTECTED] wrote: > More information can be found on our web site at > http://mgltools.scripps.edu I had some trouble finding the license of the code on the webpage, but it looks like the software is free for non-commercial use. Could I convince you to make the license more visible? Please

Re: How to get a Fix to an Abandoned Project?

2006-09-19 Thread Gregory Piñero
Say hello to pydelicious's new home ;-) http://code.google.com/p/pydelicious/ -Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to condese my array

2006-09-19 Thread James Stroud
Dean Card wrote: > I have a list of dictionaries where each dictionary defines, among other > things, a row and column number. So, my list might look like this: > [{'row':1, 'column':1, otherdata}, {'row':1, 'column':2, 'otherdata}...] > > This data is passed to flash and used there to create a

how to control file output encoding?

2006-09-19 Thread MaTianyi
the encoding of file that is output by the file.write() function is always None. and the encoding attribute of the File Object is readonly. f = open('abc.txt','w') print f.encoding >>> None how can I change the file output encoding? -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to condese my array

2006-09-19 Thread Robert Kern
Dean Card wrote: > I have a list of dictionaries where each dictionary defines, among other > things, a row and column number. So, my list might look like this: > [{'row':1, 'column':1, otherdata}, {'row':1, 'column':2, 'otherdata}...] > > This data is passed to flash and used there to create a

how to control file output encoding?

2006-09-19 Thread MaTianyi
the encoding of file that is output by the file.write() function is always None. and the encoding attribute of the File Object is readonly. f = open('abc.txt','w') print f.encoding >>> None how can I change the file output encoding? -- http://mail.python.org/mailman/listinfo/python-list

Pythonic way to condese my array

2006-09-19 Thread Dean Card
I have a list of dictionaries where each dictionary defines, among other things, a row and column number. So, my list might look like this: [{'row':1, 'column':1, otherdata}, {'row':1, 'column':2, 'otherdata}...] This data is passed to flash and used there to create a grid of objects that are p

Re: How to get a Fix to an Abandoned Project?

2006-09-19 Thread Gregory Piñero
On 9/19/06, Lawrence Oluyede <[EMAIL PROTECTED]> wrote: > Gregory Piñero <[EMAIL PROTECTED]> wrote: > > Otherwise any other advice is welcome. Should I just post > > the code somewhere else, etc? > > Maybe you can fork and maintain it somewhere else... Forking is an idea however I'd rather not be

Re: Single character input without pressing 'Enter'

2006-09-19 Thread Gabriel Genellina
At Wednesday 20/9/2006 00:40, unni.tallman wrote: how can i read input from stdin, char by char, i want to get the character as soon as it is entered, without having to press 'Enter' after each character. See this thread

Re: why a main() function?

2006-09-19 Thread anton . list
[EMAIL PROTECTED] wrote: > I think I read a suggestion somewhere to wrap the code where a Python > script starts in a main() function, so one has > What are the advantages of doing this? Others have stated all the good ones, so I'll state a slightly dumber one for us part time amateur hackers :

Re: newbe's re question

2006-09-19 Thread [EMAIL PROTECTED]
George Sakkis wrote: > [EMAIL PROTECTED] wrote: > > > All I am after realy is to change this > > > > reline = re.line.split('instr', '/d$') > > If you think this is the only problem in your code, think again; almost > every other line has an error or an unpythonic idiom. Have you read any > tutor

Hiding / showing windows in Macs

2006-09-19 Thread Sinang, Danny
Hello,   How do we hide and show windows in Macs ?   Regards, Danny     -- http://mail.python.org/mailman/listinfo/python-list

Single character input without pressing 'Enter'

2006-09-19 Thread unni.tallman
how can i read input from stdin, char by char, i want to get the character as soon as it is entered, without having to press 'Enter' after each character. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbe's re question

2006-09-19 Thread George Sakkis
[EMAIL PROTECTED] wrote: > All I am after realy is to change this > > reline = re.line.split('instr', '/d$') If you think this is the only problem in your code, think again; almost every other line has an error or an unpythonic idiom. Have you read any tutorial or sample code before typing this

Re: Python programs always open source?

2006-09-19 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Write your program in Python, and you can ignore the Python > > license when you distribute your own work. We'd love to see you > > distribute it under a free software license, but the license of > > Python has no legal effect on you

RE: Python programs always open source?

2006-09-19 Thread Delaney, Timothy (Tim)
Steve Holden wrote: > Given that many people distribute (enough of) the interpreter with > their Python programs I wouldn't like the above to be regarded as a > blanket statement that the Python license doesn't have to be > considered when distributing the interpreter with program source. In prac

Re: xlrd number of rows in worksheet (was: Re: Pre-defining an action to take when an expected error occurs)

2006-09-19 Thread John Machin
Tempo wrote: > It worked. Those two functions (usefulness_of_cells & > number_of_good_rows) seem to work flawlessly...knock on wood. I have > run a number of different Excel spreadsheets through the functions, and > so far the functions have a 100% acuracy rating. The acuracy rating is > based on

Re: xlrd number of rows in worksheet (was: Re: Pre-defining an action to take when an expected error occurs)

2006-09-19 Thread Tempo
It worked. Those two functions (usefulness_of_cells & number_of_good_rows) seem to work flawlessly...knock on wood. I have run a number of different Excel spreadsheets through the functions, and so far the functions have a 100% acuracy rating. The acuracy rating is based on the functions' returned

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Steve Holden
Paul McGuire wrote: > "Brian van den Broek" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: >> >>>The heading comment to pprint reads: >>> >>># This is a simple little module I wrote to make life easier. I >>>didn'

Re: Python programs always open source?

2006-09-19 Thread Steve Holden
Ben Finney wrote: [...] > That latter case is the only one for most interpreted Python programs: > no part of the library is in the source code of the Python program, so > the license of that library doesn't affect the licensing of the > program. > > Write your program in Python, and you can ignor

Re: Cheese Shop Registration error

2006-09-19 Thread Richard Jones
John Machin wrote: > re.match("[A-Fa-f0-9]{8,8}", data.strip()) makes it plain what is > intended ... Indeed, thanks. Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: value exists (newbie question)

2006-09-19 Thread John Machin
eldorado wrote: > Hello, > > I am trying to parse some files so that if a postal code exists, but is > longer than five digits it will return me only the first five digits: > ... > for insDict in insureDict: > insDict['postalcode'] = insDict.get('postalcode')[:5] > ... > This works, except fo

newbe's re question

2006-09-19 Thread [EMAIL PROTECTED]
All I am after realy is to change this reline = re.line.split('instr', '/d$') into something that grabs any line with instr in it take all the numbers and then grab any comment that may or may not be at the end of the line starting with ; until the end of the line including white spaces.. this

Re: Cheese Shop Registration error

2006-09-19 Thread John Machin
Richard Jones wrote: > John Machin wrote: > > | >>> int("6A61E3AD") > > Traceback (most recent call last): > > File "", line 1, in ? > > ValueError: invalid literal for int(): 6A61E3AD > > | >>> int("6A61E3AD", 16) > > 1784800173 > > > > What am I missing? > > Ah, thankyou! I, on the other hand,

Re: find class where method was defined ?

2006-09-19 Thread Simon Burton
def methclass(meth): cls = meth.im_class name = meth.im_func.__name__ meth = getattr(cls,name,None) for cls in cls.mro(): _meth = getattr(cls,name,None) if _meth is not None and _meth==meth: result = cls return result >>> methclass(b.foo) (Turns

Re: new string method in 2.5 (partition)

2006-09-19 Thread Terry Reedy
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Err... is it me being dumb, or is it a perfect use case for str.split ? s.partition() was invented and its design settled on as a result of looking at some awkward constructions in the standard library and other

Re: Python programs always open source?

2006-09-19 Thread Ben Finney
Chris Lambacher <[EMAIL PROTECTED]> writes: > On Tue, Sep 19, 2006 at 09:46:13PM +1000, Ben Finney wrote: > > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > > Ben Finney schrieb: > > > > My claim (and IANAL) is that it doesn't matter *what* license > > > > Python is distributed under; unless y

Re: find class where method was defined ?

2006-09-19 Thread James Stroud
Simon Burton wrote: class A(object): > > ... def foo(self): pass > ... > class B(A): > > ... pass > ... > b=B() b.foo > > > > > How can I work out what class b.foo was defined in ? > > > Simon. > b.__class__ -- James Stroud UCLA-DOE Institute for Genomics and Proteom

find class where method was defined ?

2006-09-19 Thread Simon Burton
>>> >>> class A(object): ... def foo(self): pass ... >>> >>> class B(A): ... pass ... >>> >>> b=B() >>> b.foo > How can I work out what class b.foo was defined in ? Simon. -- http://mail.python.org/mailman/listinfo/python-list

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Paul McGuire
"Brian van den Broek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: >> The heading comment to pprint reads: >> >> # This is a simple little module I wrote to make life easier. I >> didn't >> # see anything quite like

Re: Cheese Shop Registration error

2006-09-19 Thread Richard Jones
John Machin wrote: > | >>> int("6A61E3AD") > Traceback (most recent call last): > File "", line 1, in ? > ValueError: invalid literal for int(): 6A61E3AD > | >>> int("6A61E3AD", 16) > 1784800173 > > What am I missing? Ah, thankyou! I, on the other hand, looked at that code several times and saw

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian van den Broek
Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # something. I wrote this when I w

Re: high level, fast XML package for Python?

2006-09-19 Thread Paul Boddie
Martin v. Löwis wrote: > > It seems that everybody is proposing libraries that use in-memory > representations. There is a standard xml package for Python, it's > called "xml" (and comes with the standard library). It contains a > SAX interface, xml.sax, which can parse files incrementally. What a

pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian L. Troutwine
The heading comment to pprint reads: # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descriptive c

Re: Replace single character at given position

2006-09-19 Thread Larry Bates
Martin Kulas wrote: > Hello! > > How do I replace a single character in a string at a given position? > > From programming languages like C I expect something like that: > idx = 1 s1 = "pxthon" s1[idx] = 'y' > Traceback (most recent call last): > File "", line 1, in ? > TypeErro

Re: Replace single character at given position

2006-09-19 Thread bearophileHUGS
Martin Kulas: > Are there better (faster) ways to achieve my goal? > I have looked through the methods of type ``string'' > but I have not found any appropriate method or function. Python strings are immutable, so you can't modify them, so you can't find methods to change them. I agree that someti

Re: Replace single character at given position

2006-09-19 Thread Bjoern Schliessmann
Martin Kulas wrote: > From programming languages like C I expect something like that: > idx = 1 s1 = "pxthon" s1[idx] = 'y' > Traceback (most recent call last): > File "", line 1, in ? > TypeError: object does not support item assignment > > It does not work :-( Yes, Python str

Replace single character at given position

2006-09-19 Thread Martin Kulas
Hello! How do I replace a single character in a string at a given position? >From programming languages like C I expect something like that: >>> idx = 1 >>> s1 = "pxthon" >>> s1[idx] = 'y' Traceback (most recent call last): File "", line 1, in ? TypeError: object does not support item assignme

Re: How to get a Fix to an Abandoned Project?

2006-09-19 Thread Sashmit Bhaduri
Gregory Piñero wrote: > After repeated failed attempts to contact the author, I dive in and > fix it myself (just changing URI's really). So now I have the fixed > code and I'd like to update the project so others can use it, but I > can't seem to login to the trac page to change the code? Wait

Re: Curious issue with simple code

2006-09-19 Thread codefire
George Sakkis wrote: > By the way, an easier way to deal with paths is the path.py module > (http://www.jorendorff.com/articles/python/path/). Your example could > be rewritten simply as: > > from path import path > for html_file in path(start_dir).walkfiles('*.html'): > print 'html file found

Re: new string method in 2.5 (partition)

2006-09-19 Thread Duncan Booth
"George Sakkis" <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > >> I must definitively be dumb, but so far I fail to see how it's better >> than split and rsplit: > > I fail to see it too. What's the point of returning the separator since > the caller passes it anyway* ? > The separat

Re: How to get a Fix to an Abandoned Project?

2006-09-19 Thread Lawrence Oluyede
Gregory Piñero <[EMAIL PROTECTED]> wrote: > Otherwise any other advice is welcome. Should I just post > the code somewhere else, etc? Maybe you can fork and maintain it somewhere else... -- Lawrence - http://www.oluyede.org/blog "Nothing is more dangerous than an idea if it's the only one you h

How to get a Fix to an Abandoned Project?

2006-09-19 Thread Gregory Piñero
Hi there, I'm hoping this is at least somewhat on topic for this list. I'm not sure where else to ask. Here's the story, I was a happy user of pydelicious (http://deliciouspython.python-hosting.com/) for a few beautiful months. Then there was a del.icio.us API change (http://blog.del.icio.us/bl

Re: new string method in 2.5 (partition)

2006-09-19 Thread Jack Diederich
On Tue, Sep 19, 2006 at 07:23:50PM +, John Salerno wrote: > Bruno Desthuilliers wrote: > > > Err... is it me being dumb, or is it a perfect use case for str.split ? > > Hmm, I suppose you could get nearly the same functionality as using > split(':', 1), but with partition you also get the se

Re: new string method in 2.5 (partition)

2006-09-19 Thread John Salerno
Larry Bates wrote: > John Salerno wrote: >> Bruno Desthuilliers wrote: >> >>> Err... is it me being dumb, or is it a perfect use case for str.split ? >> Hmm, I suppose you could get nearly the same functionality as using >> split(':', 1), but with partition you also get the separator returned as >>

Re: xmlrpc, extract data from http headers

2006-09-19 Thread Filip Wasilewski
Milos Prudek wrote: > > A better solution would be to extract cookies from headers in the > > request method and return them with response (see the code below). I > > Full solution! Wow! Thank you very much. I certainly do not deserve such > kindness. Thanks a lot Filip! Glad to help. All in all t

Re: py.test and HTML output

2006-09-19 Thread Paul McGuire
"Victor Ng" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there documentation anywhere on how to get py.test to emit nice > HTML output like the kind that they have for the PyPy project here: > http://codespeak.net/~hpk/pypy-testresult/ ? > > Should I just redirect the stdout to

Re: new string method in 2.5 (partition)

2006-09-19 Thread Larry Bates
John Salerno wrote: > Bruno Desthuilliers wrote: > >> Err... is it me being dumb, or is it a perfect use case for str.split ? > > Hmm, I suppose you could get nearly the same functionality as using > split(':', 1), but with partition you also get the separator returned as > well. > >> There are

py.test and HTML output

2006-09-19 Thread Victor Ng
Is there documentation anywhere on how to get py.test to emit nice HTML output like the kind that they have for the PyPy project here: http://codespeak.net/~hpk/pypy-testresult/ ? Should I just redirect the stdout to a StringIO and parse the output and generate the HTML myself? I see that there's

Re: new string method in 2.5 (partition)

2006-09-19 Thread George Sakkis
Bruno Desthuilliers wrote: > I must definitively be dumb, but so far I fail to see how it's better > than split and rsplit: I fail to see it too. What's the point of returning the separator since the caller passes it anyway* ? George * unless the separator can be a regex, but I don't think so.

Re: new string method in 2.5 (partition)

2006-09-19 Thread Thomas Heller
John Salerno schrieb: > Bruno Desthuilliers wrote: > >> Err... is it me being dumb, or is it a perfect use case for str.split ? > > Hmm, I suppose you could get nearly the same functionality as using > split(':', 1), but with partition you also get the separator returned as > well. Well, x.spl

Re: value exists (newbie question)

2006-09-19 Thread George Sakkis
eldorado wrote: > Hello, > > I am trying to parse some files so that if a postal code exists, but is > longer than five digits it will return me only the first five digits: > ... > for insDict in insureDict: > insDict['postalcode'] = insDict.get('postalcode')[:5] > ... > This works, except f

Re: new string method in 2.5 (partition)

2006-09-19 Thread John Salerno
Bruno Desthuilliers wrote: > Err... is it me being dumb, or is it a perfect use case for str.split ? Hmm, I suppose you could get nearly the same functionality as using split(':', 1), but with partition you also get the separator returned as well. > There are IMVHO much exciting new features

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread George Sakkis
Ilias Lazaridis wrote: > I like to add a method "writeDebug(self, msg)" to all (or the most > possible) classes in the system. > > How do I do this? > > * with new style classes > * with old style classes Short answer: you can't do it for builtin or extension types: >>> list.writeDebug = lambda m

Re: help with relative imports

2006-09-19 Thread John Salerno
Robert Kern wrote: > Remember that this is code in the A.B.C module. Oh! That clears it all up! I wasn't realizing that the import statements were being executed from within the C module! Thanks! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: new string method in 2.5 (partition)

2006-09-19 Thread Tim Chase
> But you raise a good point. Notice this: > > >>> s = 'hello, world, how are you' > > >>> s.split(',') > ['hello', ' world', ' how are you'] > > >>> s.partition(',') > ('hello', ',', ' world, how are you') > > split will return all substrings. partition (and rpartition) only return > the s

Re: new string method in 2.5 (partition)

2006-09-19 Thread Tim Chase
>> partition(sep) condenses this pattern into a single method >> call that returns a 3-tuple containing the substring before >> the separator, the separator itself, and the substring after >> the separator. If the separator isn't found, the first >> element of the tuple is the entire string and th

Re: new string method in 2.5 (partition)

2006-09-19 Thread Bruno Desthuilliers
John Salerno a écrit : > Forgive my excitement, especially if you are already aware of this, but > this seems like the kind of feature that is easily overlooked (yet could > be very useful): > > > Both 8-bit and Unicode strings have new partition(sep) and > rpartition(sep) methods that simplif

Re: new string method in 2.5 (partition)

2006-09-19 Thread John Salerno
[EMAIL PROTECTED] wrote: > I'm confused. > What's the difference between this and string.split? >>> s = 'hello, world' >>> s.split(',') ['hello', ' world'] >>> s.partition(',') ('hello', ',', ' world') split returns a list of the substrings on either side of the specified argument. partit

Re: new string method in 2.5 (partition)

2006-09-19 Thread Lawrence Oluyede
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What's the difference between this and string.split? >>> ('http://www.python.org').partition('://') ('http', '://', 'www.python.org') >>> ('http://www.python.org').split('://') ['http', 'www.python.org'] -- Lawrence - http://www.oluyede.org/blog

value exists (newbie question)

2006-09-19 Thread eldorado
Hello, I am trying to parse some files so that if a postal code exists, but is longer than five digits it will return me only the first five digits: ... for insDict in insureDict: insDict['postalcode'] = insDict.get('postalcode')[:5] ... This works, except for when I get a blank postalcod

Re: new string method in 2.5 (partition)

2006-09-19 Thread [EMAIL PROTECTED]
I'm confused. What's the difference between this and string.split? John Salerno wrote: > Forgive my excitement, especially if you are already aware of this, but > this seems like the kind of feature that is easily overlooked (yet could > be very useful): > > > Both 8-bit and Unicode strings have n

Re: help with relative imports

2006-09-19 Thread Robert Kern
John Salerno wrote: > Robert Kern wrote: > >> What is ambiguous about A.B.D, A.E, and A.F.G? But if you like: > > I guess maybe I was looking at it backwards. From the way it was worded, > I thought the only information we had to use was the structure A.B.C, > and then given a statement like: >

Re: new string method in 2.5 (partition)

2006-09-19 Thread metaperl
sweet thanks for the heads up. John Salerno wrote: > Forgive my excitement, especially if you are already aware of this, but > this seems like the kind of feature that is easily overlooked (yet could > be very useful): > > > Both 8-bit and Unicode strings have new partition(sep) and > rpartition(s

Re: help with relative imports

2006-09-19 Thread [EMAIL PROTECTED]
John Salerno wrote: > Robert Kern wrote: > > > What is ambiguous about A.B.D, A.E, and A.F.G? But if you like: > > I guess maybe I was looking at it backwards. From the way it was worded, > I thought the only information we had to use was the structure A.B.C, > and then given a statement like: > >

Re: xmlrpc, extract data from http headers

2006-09-19 Thread Milos Prudek
> A better solution would be to extract cookies from headers in the > request method and return them with response (see the code below). I Full solution! Wow! Thank you very much. I certainly do not deserve such kindness. Thanks a lot Filip! -- Milos Prudek -- http://mail.python.org/mailman/l

Re: Curious issue with simple code

2006-09-19 Thread George Sakkis
codefire wrote: > Ah of course, isfile(f) can only return true if it can find f! :) > > I'm going to investigate those other functions too :) > > Thanks a lot guys! > Tony By the way, an easier way to deal with paths is the path.py module (http://www.jorendorff.com/articles/python/path/). Your ex

new string method in 2.5 (partition)

2006-09-19 Thread John Salerno
Forgive my excitement, especially if you are already aware of this, but this seems like the kind of feature that is easily overlooked (yet could be very useful): Both 8-bit and Unicode strings have new partition(sep) and rpartition(sep) methods that simplify a common use case. The find(S) meth

Re: Nano Technology Application For Health,Wellness and Beauty

2006-09-19 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dear lovely moderator, please allow me to spread this information, > somebody might need it, please forgive me if you are bothered > > Dear All, this might be useful for you and your family > Does it also predict earthquakes? For yo

Re: help with relative imports

2006-09-19 Thread John Salerno
Robert Kern wrote: > What is ambiguous about A.B.D, A.E, and A.F.G? But if you like: I guess maybe I was looking at it backwards. From the way it was worded, I thought the only information we had to use was the structure A.B.C, and then given a statement like: from . import D we just had to f

Re: Mechanoid Web Browser - Recording Capability

2006-09-19 Thread John J. Lee
"Seymour" <[EMAIL PROTECTED]> writes: [...] > one program, MaxQ, that records web surfing. It seems to work great. [...] There are lots of such programs about (ISTR twill used to use MaxQ for its recording feature, but I think Titus got rid of it in favour of his own code, for some reason). How

Re: Installing Python on a 64-Bit OS

2006-09-19 Thread Martin v. Löwis
Nico Grubert schrieb: > Is there anything special I have to care about or is installing Python > on a 64 Bit OS just as easy as installing it on a 32-Bit OS? Despite what everybody else said: most likely, special care is necessary. However, nobody probably knows what precisely you need to be aware

Python 2.5 slower with pyparsing 1.4.3

2006-09-19 Thread Paul McGuire
Running my Verilog parser tests, I get a 5-10% slowdown with Python 2.5 vs. Python 2.4.1 (See http://pyparsing.wikispaces.com/News.) I apologize for not running performance tests sooner, I only ran regression tests on the release candidates, and those were all okay. I'll look through the "What'

Re: Mechanoid Web Browser - Recording Capability

2006-09-19 Thread John J. Lee
"Seymour" <[EMAIL PROTECTED]> writes: > Somehow I had the notion that Mechanize was a Pearl script. mechanize the Python module started as a port of Andy Lester's Perl module WWW::Mechanize (in turn based on Gisle Aas' libwww-perl), and on some very high level has "the same" conceptual interface,

Re: help with relative imports

2006-09-19 Thread Robert Kern
John Salerno wrote: > I'm reading the "What's New" section of the 2.5 docs, and I'm a little > confused by the last section of "Absolute and Relative Imports": > > --- > For example, code in the A.B.C module can do: > > from . import D

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Steve Holden
Ilias Lazaridis wrote: > MonkeeSage wrote: > >>Ilias Lazaridis wrote: >> >>>How do I do this? >> >>It's easy: >> >>def writeDebug(msg): >> print "I do not debug things, I _evaluate_ with professionals on the >>industries! See ticket 547!\n" \ >>"Oh yeah, and %s" % msg > > > where do I p

Re: Installing 2.5 with 2.4?

2006-09-19 Thread John Salerno
John Machin wrote: > I'd suggest that you uninstall 2.4 later if at all. Ensure that you > have got all the extensions you want/need for 2.5 before you burn your > boats. As Diez says in effect, there is no guarantee that any > particular extension is available for 2.5 on Windows right now. > Tha

help with relative imports

2006-09-19 Thread John Salerno
I'm reading the "What's New" section of the 2.5 docs, and I'm a little confused by the last section of "Absolute and Relative Imports": --- For example, code in the A.B.C module can do: from . import D # Imports A.B.D from .. import E

Re: Curious issue with simple code

2006-09-19 Thread codefire
Ah of course, isfile(f) can only return true if it can find f! :) I'm going to investigate those other functions too :) Thanks a lot guys! Tony -- http://mail.python.org/mailman/listinfo/python-list

Re: Curious issue with simple code

2006-09-19 Thread Tim Chase
> [code] > import os > > def print_tree(start_dir): > for f in os.listdir(start_dir): > fp = os.path.join(start_dir, f) > print fp > if os.path.isfile(fp): # will return false if use f here! > if os.path.splitext(fp)[1] == '.html': >

Re: Curious issue with simple code

2006-09-19 Thread MonkeeSage
codefire wrote: > As above it all works as expected. However, on the marked line, if I > use f instead of fp then that condition returns false! Surely, > isfile(f) should return true, even if I just give a filename, rather > than the full path? Hi Tony, Actually the file is in a different directo

Re: Curious issue with simple code

2006-09-19 Thread Diez B. Roggisch
codefire wrote: > Hi, > > I have some simple code - which works...kind of..here's the code: > > [code] > import os > > def print_tree(start_dir): > for f in os.listdir(start_dir): > fp = os.path.join(start_dir, f) > print fp > if os.path.isfile(fp): # will return fal

RE: Curious issue with simple code

2006-09-19 Thread Richard Morello
Dear Tony, You're not in that directory (start_dir) when the isfile() function is called. See function os.path.curdir() and os.chdir(). Also, you may be confusing the behavior of os.path.walk(), in which the function called will happen once you have been chdired to the directory it is examining.

Re: Curious issue with simple code

2006-09-19 Thread Fredrik Lundh
codefire wrote: > As above it all works as expected. However, on the marked line, if I > use f instead of fp then that condition returns false! Surely, > isfile(f) should return true, even if I just give a filename, rather > than the full path? try printing both "f" and "fp", and see if you can

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread MonkeeSage
Ilias Lazaridis wrote: > where do I place this function... The place where you want it to be. > ...thus it becomes available within class "Foo" and all other Classes? Anything defined in the top-level (i.e., the sys.modules['__main__'] namespace) is accessible in every scope...but I assume you a

Re: win32 Service: path to .py script

2006-09-19 Thread Gregor Horvath
Larry Bates schrieb: > I believe that your problem is that services run under Local > System account. Normally Local System account would not have > a drive mapping Y:\. You can change the account that a service You are absolutly correct. I moved the script to a local drive instead of a mapped

Re: I need some tips to begin a simple project

2006-09-19 Thread codefire
dutche wrote: > Now, that I know a bit of Python, I want to make some simple project, I > thought something like a menu, just like "kxdocks" menu or something > like that, with transparency and all with xml. But I dont know what > things I have to know. > Start with some simple non-gui apps firs

  1   2   >