Re: Python 2.5 Installation and Tkinter

2006-09-22 Thread Martin v. Löwis
milan_sanremo schrieb: > cc -shared > build/temp.solaris-2.10-i86pc-2.5/tmp/Python-2.5/Modules/_tkinter.o > build/temp.solaris-2.10-i86pc-2.5/tmp/Python-2.5/Modules/tkappinit.o > -L/usr/openwin/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o > build/lib.solaris-2.10-i86pc-2.5/_tkinter.so > > Yet, t

Re: Application logging to screen and file - any favorite modules (no luck on cheeseshop)

2006-09-22 Thread Robert Kern
metaperl wrote: > Hello, I am looking for a module which has > * log levels > * output to stdout and file (either/or based on config) > * nicely formatted log output (e.g., indentation when appropriate) > > I tried to use cheeseshop to find such a module, but came up short. I > clicked on > Browse

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Martin v. Löwis
Rob Williscroft schrieb: > Having read Noel Byron's reply also, I'm tempted to say there is > some confusion here between a Visual *Studio* toolkit (VS 2003) > and a Visual *C++* toolkit (VC 2003). Ah, that could well be. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Building things with setup.py

2006-09-22 Thread Martin v. Löwis
James Stroud schrieb: > I think I would like to know how to avoid or correct these sort of > issues in the future, which seem to be limited, for me at least, to > scipy and numpy, with the possible exception of MySQLdb and its > dependency on zlib. Ideally, I would like to understand exactly what >

Application logging to screen and file - any favorite modules (no luck on cheeseshop)

2006-09-22 Thread metaperl
Hello, I am looking for a module which has * log levels * output to stdout and file (either/or based on config) * nicely formatted log output (e.g., indentation when appropriate) I tried to use cheeseshop to find such a module, but came up short. I clicked on Browse Tree -> Software Development bu

Re: Help me use my Dual Core CPU!

2006-09-22 Thread Paul Rubin
"Michael Sparks" <[EMAIL PROTECTED]> writes: > > Kamaelia doesn't attempt concurrency at all. Its main idea is to use > > generators to simulate microthreads. > > Regarding Kamaelia, that's not been the case for over a year now. > > We've had threaded components as well as generator based ones s

Re: How to close the DOS Shell when starting a python script

2006-09-22 Thread Paddy
[EMAIL PROTECTED] wrote: > Hello all. > I know the question will seem stupid but googling it gives me only > stuff I don't care about. > So the question is the following: > When I start a python script containing a wxApp under windows XP, I > double click , my program opens and a background DOS sh

How to close the DOS Shell when starting a python script

2006-09-22 Thread m . errami
Hello all. I know the question will seem stupid but googling it gives me only stuff I don't care about. So the question is the following: When I start a python script containing a wxApp under windows XP, I double click , my program opens and a background DOS shell also opens. Is there any way to pr

Re: Is it possible to change a picture resolution with Python?

2006-09-22 Thread Tim Roberts
"Lad" <[EMAIL PROTECTED]> wrote: > >Tim , >Thank you for the explanation, >And I must also thank you all you others, who helped me. >Particularly, bearophile and Max. > >Now I use the following code , that provided bearophile, > >from PIL import Image >im = Image.open("output3.jpg") >nx, ny = im.s

Re: Automatic import PEP

2006-09-22 Thread Michel Claveau
Hi! >>> I have also found "autoimp" useful in writing normal Python... +1 -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

grabbing random words

2006-09-22 Thread Jay
How would I be able to grab random words from an internet source. I'd like to grab a random word from a comprehensive internet dictionary. What would be the best source and the best way to go about this? Thanks. (Sorry if this sounds/is super noobish.) -- http://mail.python.org/mailman/listinfo

Re: +1 QOTW

2006-09-22 Thread Ray
[EMAIL PROTECTED] wrote: > Did anyone else crack up when Larry Wall described python with the > statement: > > Python, as the "anti-Perl," is heavily invested in maintaining Order. Perl? Larry who? (I've been going to a hypnotherapist who specializes in erasing bad memories of the past, sorry.)

Re: returning None instead of value: how to fix?

2006-09-22 Thread Neil Cerutti
On 2006-09-22, sam <[EMAIL PROTECTED]> wrote: >> Missing a return on the last line is likely your immediate >> problem. > > thanks to everyone for pointing this out. obviously, i had not > understood what was actually involved in a recursive call. i > have corrected it as suggested and it works fin

Automatic import PEP

2006-09-22 Thread Connelly Barnes
Hi, I wrote the 'autoimp' module [1], which allows you to import lazy modules: from autoimp import * (Import lazy wrapper objects around all modules; "lazy modules" will turn into normal modules when an attribute is first accessed with g

Re: String Pattern Matching: regex and Python regex documentation

2006-09-22 Thread J�rgen Exner
Ilias Lazaridis wrote: > Xah Lee wrote: >> the Python regex documentation is available at: >> http://xahlee.org/perl-python/python_re-write/lib/module-re.html Yeah, sure, and the Perl regex documentation is available at 'perldoc perlre'. So what? Is that anything new or surprising? jue -- ht

Re: Fatal error after RE-installing Python 2.3.4

2006-09-22 Thread John Machin
Cappy2112 wrote: > I've just started a job which has a massive python2.3.4-centric tools > installation and configuration. > > I know what you're going to say, but I can't upgrade and be the only > one with a newer version. There are close to 30 engineers using this > same tools configuration, and

Re: Fatal error after RE-installing Python 2.3.4

2006-09-22 Thread Eric
Cappy2112 wrote: > I've just started a job which has a massive python2.3.4-centric tools > installation and configuration. > > I know what you're going to say, but I can't upgrade and be the only > one with a newer version. There are close to 30 engineers using this > same tools configuration, and

Re: Replacing line in a text file

2006-09-22 Thread Eric
CSUIDL PROGRAMMEr wrote: > Folks > I am trying to read a file > This file has a line containing string 'disable = yes' > > I want to change this line to 'disable = no' > > The concern here is that , i plan to take into account the white spaces > also. > > I tried copying all file int list and the

Fatal error after RE-installing Python 2.3.4

2006-09-22 Thread Cappy2112
I've just started a job which has a massive python2.3.4-centric tools installation and configuration. I know what you're going to say, but I can't upgrade and be the only one with a newer version. There are close to 30 engineers using this same tools configuration, and it has been working fine for

Re: Replacing line in a text file

2006-09-22 Thread Eric
Tim Chase wrote: > > That is, until such time as Guido finalizes PyESP. > > > > import PyESP > > e = ESP.mindread(CSUIDL, "r") > > Sounds like an extension to the __future__ module. > > >>> from __future__ import answers > >>> answers.answer(op.question) > > How many other languages have a time-

Re: Does Python provide "Struct" data structure?

2006-09-22 Thread Brian Blais
Daniel Mark wrote: > > 1> Does Python provide such Struct in this standard libary. > Python has "4.3 struct -- Interpret strings as packed binary data", but > it looks like different > from what I really want to get. I like the following version: class Struct(dict): def __getattr__(self,na

Re: Global module variables as default parameters

2006-09-22 Thread Steve Holden
John Hunter wrote: >>"Christoph" == Christoph Haas <[EMAIL PROTECTED]> writes: > > > Christoph> Hi, list... I wondered if it's possible to use global > Christoph> (module) variables as default parameters. A simple > Christoph> working example: > > Christoph>

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Steve Holden
MonkeeSage wrote: > Hi Saizan, > > I don't really see anything wrong with creating a custom class for > evaluating those kinds of logical statements. It does make the code for > statements more concise and easy to follow (with less binding > ambiguity). Mabye something like this would help: > > c

Re: Python Input from keyboard

2006-09-22 Thread Eric
> std::cin << value; Oops, that should be >>. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Input from keyboard

2006-09-22 Thread Eric
utab wrote: > hi, > I could not understand why python stdin and stdout are not explained in > any of the tutorials on the net, > > I want to read some input continuously from keyboard and then I would > like to process these input. > > I have a code like this but getting errors, I would like to ter

Re: Best practice for large source code projects

2006-09-22 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > It works and things make sense to me. Yet, I feel uneasy that my > model.py file is starting to approach 500 lines. What's the best > practice or community opinion on this? Do I keep everything in a single > file or do I start dividing things into s

Doctests for nested functions

2006-09-22 Thread bearophileHUGS
Recently I have posted this same question on it.comp.lang.python, maybe there aren't solutions, but I'd like to know what you think. Can doctests be added to nested functions too? (This can be useful to me, I use nested function when I don't have attributes that I have to remember, but I want to s

Re: Building things with setup.py

2006-09-22 Thread Ben Finney
James Stroud <[EMAIL PROTECTED]> writes: > I try things until a build works. I consider everything I do > until acquiring a working build as necessary. Going back to see > exactly what I did to make things work is not a viable option Before trying such "I don't know what I need to do, but I'm goi

Re: Strange behaviour of 'is'

2006-09-22 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Perfectly all right: you make the point very well that the behavior is > an implementation artifact and not a language feature. And for those who may be thinking "oh, so I can at least depend on the behaviour within a particular implementation", that's

Re: Don't use regular expressions to "validate" email addresses

2006-09-22 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > I don't "validate" email addresses by regular expression. > > > Just as a matter of interest, are you expecting that you'll find out > about the undeliverable ones? Because in many cases nowadays you > wont, since so many domains ar

Re: Best practice for large source code projects

2006-09-22 Thread faulkner
several of my programs are thousands of lines long, and i don't think they're extravagantly large. i'd say you should use modules the same way you use classes and functions: to separate code logically. if it makes sense to think of a group of statements as a function, you make it a function. if it

Re: Python 2.5 Installation and Tkinter

2006-09-22 Thread milan_sanremo
milan_sanremo wrote: > Under Solaris 10 I installed tcl 8.5 and tk8.5 and they work just fine. > I built both with > ./configure -prefix /usr/local/python/lib > > I then set LD_RUN_PATH to /usr/local/python/lib and ran the ./configure > for Python 2.5 with no arguments. When I run make, it state

Re: python-Levenshtein-0.10.1

2006-09-22 Thread joshbloom
Thanks for the help guys! -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't use regular expressions to "validate" email addresses (was: Ineed some help with a regexp please)

2006-09-22 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Damjan <[EMAIL PROTECTED]> wrote: >>> you'd create something to allow anyone to >>> potentially spam the hell out of a system... >> >> I'm sorry, but I fail to see how validating (or not) an email address >> could prevent using a webmail form for spamming. Care to

Re: Is it just me, or is Sqlite3 goofy?

2006-09-22 Thread Scott David Daniels
Fredrik Lundh wrote: >... dynamic typing != random typing. So true. To get a really good random typing going, you need a cryptographically strong random number generator to feed the application of type constructors to values during the execution of a program. Perhaps the best way to do this is t

Re: Need some help here

2006-09-22 Thread ian
"Frank Drackman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] : : "Kareem840" <[EMAIL PROTECTED]> wrote in message : news:[EMAIL PROTECTED] : > Hello. Unfortunately, I am in need of money to pay my credit card : > bills. If you could spare just $1, I would be grateful. I have a Pay

Re: python-Levenshtein-0.10.1

2006-09-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'd like to move my app over to linux machine and am wondering if > someone could help me understand how to 'install' this extension on a > linux machine? unless the README in the distribution says otherwise, following the instructions in the standard "Installing Pytho

Re: python-Levenshtein-0.10.1

2006-09-22 Thread joshbloom
Well I feel kind of stupid.. But here's the answer in case anyone else searches for this. python setup.py install -jb [EMAIL PROTECTED] wrote: > Hi Guys, > > I've been using this c implementation > http://trific.ath.cx/resources/python/levenshtein/ on a windows box and > it works great. > > I'

Re: String Pattern Matching: regex and Python regex documentation

2006-09-22 Thread John Machin
Paul McGuire wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > > Ilias Lazardis meets Xah Lee. I just *know* we're in for trouble now ... > > > > regards > > Steve > > A sign of the End Times, perhaps? > Indeed. Armageddon outa here ;-) -- http://

Re: Python Input from keyboard

2006-09-22 Thread MonkeeSage
utab wrote: > I want to read some input continuously from keyboard and then I would > like to process these input. > > I have a code like this but getting errors, I would like to terminate > when there is an empty string in the input, why is not this easy as the > "cin" or "scanf". I had to search

Re: python-Levenshtein-0.10.1

2006-09-22 Thread John Machin
[EMAIL PROTECTED] wrote: > Hi Guys, > > I've been using this c implementation > http://trific.ath.cx/resources/python/levenshtein/ on a windows box and > it works great. > > I'd like to move my app over to linux machine and am wondering if > someone could help me understand how to 'install' this e

Best practice for large source code projects

2006-09-22 Thread [EMAIL PROTECTED]
I'm developing a web system and based on some patterns I've seen elsewhere, I made a single file (model.py) to hold all of the functions and classes that define the model porition of the application. Hence the code in the controller looks like: import model def Display(req,id): # It wor

Re: shlex.split != shlex.shlex get_token til eof

2006-09-22 Thread p . lavarre
> shlex.split gives me what I want ... > every doc'ed instantiation of shlex.shlex ... gives me something else ... Aye, the discrepancies are gross & legion - presumably astonishing only newbies like me. Here's a more dramatic example: >>> import shlex >>> shlex.split("//./PhysicalDrive9 //./Cdr

Re: +1 QOTW

2006-09-22 Thread [EMAIL PROTECTED]
James Stroud wrote: > Terry Reedy wrote: > > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>Did anyone else crack up when Larry Wall described python with the > >>statement: > >> > >>Python, as the "anti-Perl," is heavily invested in maintaining Order. > >> > >>In the stat

python-Levenshtein-0.10.1

2006-09-22 Thread joshbloom
Hi Guys, I've been using this c implementation http://trific.ath.cx/resources/python/levenshtein/ on a windows box and it works great. I'd like to move my app over to linux machine and am wondering if someone could help me understand how to 'install' this extension on a linux machine? Thanks, J

Python Input from keyboard

2006-09-22 Thread utab
hi, I could not understand why python stdin and stdout are not explained in any of the tutorials on the net, I want to read some input continuously from keyboard and then I would like to process these input. I have a code like this but getting errors, I would like to terminate when there is an e

Re: no-installation version of python

2006-09-22 Thread Robert Kern
Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > >> Is there a stand-alone version of python out there that I can >> package with my scripts so that I don't have to bother with >> something like py2exe? > > Isn't this the exact intention of py2exe? I think he wants a no-install (or, perha

Re: Building things with setup.py

2006-09-22 Thread Robert Kern
James Stroud wrote: > Robert Kern wrote: >>> Sorry. To clarify, making libpython2.5a available in a >>> $LD_LIBRARY_PATH was necessary to build numpy and scipy. >> I don't see how that could have affected anything. Static libraries >> aren't looked up in $LD_LIBRARY_PATH. Certainly not for build-

Re: String Pattern Matching: regex and Python regex documentation

2006-09-22 Thread Paul McGuire
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Ilias Lazardis meets Xah Lee. I just *know* we're in for trouble now ... > > regards > Steve A sign of the End Times, perhaps? -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread MonkeeSage
Hi Saizan, I don't really see anything wrong with creating a custom class for evaluating those kinds of logical statements. It does make the code for statements more concise and easy to follow (with less binding ambiguity). Mabye something like this would help: class logic(int): def __sub__(sel

Re: +1 QOTW

2006-09-22 Thread Paddy
[EMAIL PROTECTED] wrote: > Did anyone else crack up when Larry Wall described python with the > statement: > > Python, as the "anti-Perl," is heavily invested in maintaining Order. > > In the state of the onion address? > > http://www.perl.com/pub/a/2006/09/21/onion.html -3 on QOTW ! The whole ar

Python 2.5 Installation and Tkinter

2006-09-22 Thread milan_sanremo
Under Solaris 10 I installed tcl 8.5 and tk8.5 and they work just fine. I built both with ./configure -prefix /usr/local/python/lib I then set LD_RUN_PATH to /usr/local/python/lib and ran the ./configure for Python 2.5 with no arguments. When I run make, it states: INFO: Can't locate Tcl/Tk lib

Re: returning None instead of value: how to fix?

2006-09-22 Thread sam
> Missing a return on the last line is likely your immediate problem. thanks to everyone for pointing this out. obviously, i had not understood what was actually involved in a recursive call. i have corrected it as suggested and it works fine now. > You have more subtle problems, though. First,

Re: License / Registration key enabled software

2006-09-22 Thread James Stroud
T wrote: > We all know that there are many softwares that require some license key > or registration key to enable them. How does one implement something > like this in python? > Here's a thought: AES encrypt the bytecode dynamically for each user, using as a key an sha hash of their personal a

Re: what is the best practice to separate Pygtk and long running thread code

2006-09-22 Thread [EMAIL PROTECTED]
seb wrote: > Hi, > > I am using pygtk for the first times. > > I am wondering what would be the best "pattern" to interface pygtk with > a thread. > > The thread is collecting informations (over the network for example) or > is doing some long calculations. It sounds like you don't need to share a

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Rob Williscroft
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= wrote in news:4514479B.5070808 @v.loewis.de in comp.lang.python: > Rob Williscroft schrieb: >> Download the 1.1 SDK: >> >> http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6- >> 3647-4070-9F41-A333C6B9181D&displaylang=en> >> >> yes it do

Re: send with timeout socket

2006-09-22 Thread Bryan Olson
Stéphane Ninin wrote: > I want to make sure that, if nothing is sent after some time, > if event "terminated" is set, > then the thread doesnot spend more time trying to send something which > has become useless. You should be good then. The timeout is on each send(), and send times out if and o

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Martin v. Löwis wrote: > James Stroud schrieb: > >>>What happens if you omit these flags? >> >>Please see my last message to Robert Kern. > > > If you don't want me to help you, that's fine, then I won't. > > I couldn't find an answer to this question in any of your > messages in this thread.

Re: Replacing line in a text file

2006-09-22 Thread Frederic Rentsch
CSUIDL PROGRAMMEr wrote: > Folks > I am trying to read a file > This file has a line containing string 'disable = yes' > > I want to change this line to 'disable = no' > > The concern here is that , i plan to take into account the white spaces > also. > > I tried copying all file int list and then

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-22 Thread Bjoern Schliessmann
Saizan wrote: > Thanks for pointing that out ( the "!" is a misstyped "|"), Ah, I suspected so. > my classes of discrete math have warped my mind with a mix of > various non-C-style operators notation, I never use bitwise > operation and this is just a bad day for thinking about things.. Hehe,

Re: Python Threading

2006-09-22 Thread Bryan Olson
daniel wrote: > Can anyone explain the main points in working with threads in Python. They are system threads, so the main points are much like in other languages. Examine how thread.lock works, and look up the queue module. > Why use threading and not Thread. There's no reason not to use thread

Looking for opinions

2006-09-22 Thread crystalattice
I've been working on a game for several months but now I'm thinking I may be going about it the wrong way. It's an online RPG designed to recreate a pen & paper session, kind of like the OpenRPG project. Originally I planned on doing something like OpenRPG with a Python app that contained everyth

Re: no-installation version of python

2006-09-22 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Is there a stand-alone version of python out there that I can package > with my scripts so that I don't have to bother with something like > py2exe? Yes, google for "movable Python". Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Are the CALL_FUNCTION_* opcodes ever used?

2006-09-22 Thread Fabiano Sidler
On Thursday 21 September 2006 22:36, Peter Otten wrote: > >>> def test(): > > ... func(*args) > ... func(**kw) > ... func(*args, **kw) Oh, I didn't know the possibility of using the *args and **kwargs semantics at function call. Thank you for revealing them to me! :) Now it is also obv

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Martin v. Löwis
Rob Williscroft schrieb: > Download the 1.1 SDK: > > http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6- > 3647-4070-9F41-A333C6B9181D&displaylang=en> > > yes it does have 90 odd megabytes of stuff you don't want but the C/C++ > compiler is in there. That's yet another option. Som

Re: returning None instead of value: how to fix?

2006-09-22 Thread Carl Banks
sam wrote: > def recursive_halve(value): > > if value < 1: > print value > return value > else: > value = value/2 > print value > if value < 1: > return value > else: > recursive_halve(value) Missing a return on the last line is like

Re: no-installation version of python

2006-09-22 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Is there a stand-alone version of python out there that I can > package with my scripts so that I don't have to bother with > something like py2exe? Isn't this the exact intention of py2exe? Regards, Björn -- BOFH excuse #247: Due to Federal Budget problems we hav

Re: Building things with setup.py

2006-09-22 Thread Martin v. Löwis
James Stroud schrieb: >> What happens if you omit these flags? > > Please see my last message to Robert Kern. If you don't want me to help you, that's fine, then I won't. I couldn't find an answer to this question in any of your messages in this thread. Still, it *should* work out of the box. I

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Robert Kern wrote: > James Stroud wrote: > >> Well I added those arguments to $LDFLAGS, but it seemed like a pretty >> miserable hack, especially the "-shared" part. > > > Hmmm. Did you have $LDFLAGS set to anything (or more likely, nothing) > before? I.e. did you have something like this? >

Re: Global module variables as default parameters

2006-09-22 Thread John Hunter
> "Christoph" == Christoph Haas <[EMAIL PROTECTED]> writes: Christoph> Hi, list... I wondered if it's possible to use global Christoph> (module) variables as default parameters. A simple Christoph> working example: Christoph> Chris

no-installation version of python

2006-09-22 Thread mr . porteiro . head
Is there a stand-alone version of python out there that I can package with my scripts so that I don't have to bother with something like py2exe? -- http://mail.python.org/mailman/listinfo/python-list

Re: +1 QOTW

2006-09-22 Thread James Stroud
Terry Reedy wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Did anyone else crack up when Larry Wall described python with the >>statement: >> >>Python, as the "anti-Perl," is heavily invested in maintaining Order. >> >>In the state of the onion address? >> >>http://www

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Robert Kern wrote: >> Sorry. To clarify, making libpython2.5a available in a >> $LD_LIBRARY_PATH was necessary to build numpy and scipy. > > I don't see how that could have affected anything. Static libraries > aren't looked up in $LD_LIBRARY_PATH. Certainly not for build-time linking. OK--new

Re: new string method in 2.5 (partition)

2006-09-22 Thread Gabriel Genellina
At Friday 22/9/2006 04:53, Lawrence D'Oliveiro wrote: > ... a python string has both a length *and* a null terminator (for > ease of interfacing C routines ... How does that work for strings with embedded nulls? Or are the C routines simply fooled into seeing a truncated part of the string? T

Re: returning None instead of value: how to fix?

2006-09-22 Thread georgeryoung
sam wrote: > i am starting to experiment with recursion, and decided to write a > fairly trivial little program which took a float as input, then called > a function to halve it recursively until it was less than 1: > > import recu

Re: returning None instead of value: how to fix?

2006-09-22 Thread Neil Cerutti
On 2006-09-22, sam <[EMAIL PROTECTED]> wrote: > i am starting to experiment with recursion, and decided to > write a fairly trivial little program which took a float as > input, then called a function to halve it recursively until it > was less than 1: > > __

Re: Newbie RE question

2006-09-22 Thread bearophileHUGS
T: > I meant to say: Search for any character in r'/\:*?"<>|' in a string You don't need a RE to solve such problem. There are many ways to solve it, this is one of the simpler (Python 2.4+): >>> chars = set(r'/\:*?"<>|') >>> s1 = "is this a sample string?" >>> bool( set(s1) & chars ) True >>> s

Re: Newbie RE question

2006-09-22 Thread Tim Chase
> I would like to search for any of the strings in r'/\:*?"<>|' in a > string using RE module. Can someone tell me how? use the search() method of the regexp object. r = re.compile(r'[/\:*?"<>|]') results = r.search(a_string) or, if you're interested in the first location: r.finditer(target).n

Re: Newbie RE question

2006-09-22 Thread Neil Cerutti
On 2006-09-22, T <[EMAIL PROTECTED]> wrote: > I meant to say: Search for any character in r'/\:*?"<>|' in a > string Sorry Ford Prefect puts The Python Documentation down on his satchel and lies down to sleep. He whispers, "I don't want to spoil anything, but you'll never get anywhere using

returning None instead of value: how to fix?

2006-09-22 Thread sam
i am starting to experiment with recursion, and decided to write a fairly trivial little program which took a float as input, then called a function to halve it recursively until it was less than 1: import recursive_halve_module

Re: Tkinter button not working as expected

2006-09-22 Thread vagrantbrad
Thank you Fredrik. It makes total sense now that you've explained it this way. I frustrated at my ignorance on the assignment issue :) Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I've created a short test program that uses tkFileDialog.askdirectory > > to help the user input a path

Re: CONSTRUCT - New/Old Style Classes, build-in/extension types

2006-09-22 Thread Steve Holden
Ilias Lazaridis wrote: > Steve Holden wrote: > >>Paul Boddie wrote: >> >>>Ilias Lazaridis wrote: >> >>[...] >> Have those old style classes any benefits? >>> >>> >>>That you don't have to write the bizarre conceptual accident that is >>>"(object)" when declaring a "top-level" class? >>> >> >>T

Re: String Pattern Matching: regex and Python regex documentation

2006-09-22 Thread Steve Holden
Ilias Lazaridis wrote: > [followup to c.l.py] > > Xah Lee wrote: > >>the Python regex documentation is available at: >>http://xahlee.org/perl-python/python_re-write/lib/module-re.html >> >>Note that, i've just made the terms of use clear. >> >>Also, can anyone answer what is the precise terms of

Re: String Pattern Matching: regex and Python regex documentation

2006-09-22 Thread Ilias Lazaridis
[followup to c.l.py] Xah Lee wrote: > the Python regex documentation is available at: > http://xahlee.org/perl-python/python_re-write/lib/module-re.html > > Note that, i've just made the terms of use clear. > > Also, can anyone answer what is the precise terms of license of the > official python

Re: Does Python provide "Struct" data structure?

2006-09-22 Thread MonkeeSage
Hi Daniel, To avoid problems you could vendor the ipython file you require, but an easier solution may just be to implement your own version of the class (it's extreemly easy): class struct(): def __init__(self, *args, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) mystru

License / Registration key enabled software

2006-09-22 Thread T
We all know that there are many softwares that require some license key or registration key to enable them. How does one implement something like this in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie RE question

2006-09-22 Thread T
I meant to say: Search for any character in r'/\:*?"<>|' in a string Sorry T wrote: > I would like to search for any of the strings in r'/\:*?"<>|' in a > string using RE module. Can someone tell me how? > > Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Newbie RE question

2006-09-22 Thread T
I would like to search for any of the strings in r'/\:*?"<>|' in a string using RE module. Can someone tell me how? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - New/Old Style Classes, build-in/extension types

2006-09-22 Thread Ilias Lazaridis
Paul Boddie wrote: > Ilias Lazaridis wrote: ... (helpful comments) > > Have those old style classes any benefits? > > That you don't have to write the bizarre conceptual accident that is > "(object)" when declaring a "top-level" class? This was most possibly done for back-compatibility reasons.

Re: py2exe compression not working with Python 2.5

2006-09-22 Thread nikie
Thomas Heller wrote: > nikie schrieb: > > When I try to compress the output of py2exe like this: > > > > from distutils.core import setup > > import py2exe > > > > setup(console=['hello.py'], options={"py2exe": {"compressed": 1}}) > > > > I get strange error messages: > > > > Adding zlib.pyd

Re: CONSTRUCT - New/Old Style Classes, build-in/extension types

2006-09-22 Thread Ilias Lazaridis
Steve Holden wrote: > Paul Boddie wrote: > > Ilias Lazaridis wrote: > [...] > >>Have those old style classes any benefits? > > > > > > That you don't have to write the bizarre conceptual accident that is > > "(object)" when declaring a "top-level" class? > > > Though of course the easiest way to en

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-22 Thread Ilias Lazaridis
Steve Holden wrote: > Michele Simionato wrote: > > (I don't believe I am responding to a notorious troll ...) > > > Believe it. You are. Ain't life a bitch? :-) > > > One (bad) solution is to write in your sitecustomize.py the following: > > > > $ echo /usr/lib/python/sitecustomize.py > > import __

Re: Replacing line in a text file

2006-09-22 Thread Tim Chase
> That is, until such time as Guido finalizes PyESP. > > import PyESP > e = ESP.mindread(CSUIDL, "r") Sounds like an extension to the __future__ module. >>> from __future__ import answers >>> answers.answer(op.question) How many other languages have a time-machine built-in, that will take th

shlex.split != shlex.shlex get_token til eof

2006-09-22 Thread p . lavarre
How can I instantiate shlex.shlex to behave like shlex.split does? I see shlex.split gives me what I want: import shlex print shlex.split("1.2e+3")[0] # 1.2e+3 But every doc'ed instantiation of shlex.shlex surprisingly gives me something else: s1 = shlex.shlex("1.2e+3", None, False) pr

Re: py2exe compression not working with Python 2.5

2006-09-22 Thread Thomas Heller
nikie schrieb: > When I try to compress the output of py2exe like this: > > from distutils.core import setup > import py2exe > > setup(console=['hello.py'], options={"py2exe": {"compressed": 1}}) > > I get strange error messages: > > Adding zlib.pyd to C:\tests\CanControllerTest\New Folde

Re: +1 QOTW

2006-09-22 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Did anyone else crack up when Larry Wall described python with the > statement: > > Python, as the "anti-Perl," is heavily invested in maintaining Order. > > In the state of the onion address? > > http://www.perl.com/pub/a/2006/09/21/o

Re: Replacing line in a text file

2006-09-22 Thread Tim Chase
> I am trying to read a file > This file has a line containing string 'disable = yes' > > I want to change this line to 'disable = no' Sounds like sed -i 's/disable *= *yes/disable = no/' file.txt would do what you want. It doesn't catch word boundaries, so if you have something like

Re: Building things with setup.py

2006-09-22 Thread Robert Kern
James Stroud wrote: > Robert Kern wrote: >> James Stroud wrote: >>> The build process, by the way, required my copying libpython2.5.a to >>> $HOME/Programs/lib. >> Hmm. That doesn't quite sound right, but it's been a while since I >> compiled the interpreter from source. > > Sorry. To clarify,

Re: Replacing line in a text file

2006-09-22 Thread Neil Cerutti
On 2006-09-22, CSUIDL PROGRAMMEr <[EMAIL PROTECTED]> wrote: > Folks > I am trying to read a file > This file has a line containing string 'disable = yes' > > I want to change this line to 'disable = no' > > The concern here is that , i plan to take into account the white spaces > also. > > I tried

Replacing line in a text file

2006-09-22 Thread CSUIDL PROGRAMMEr
Folks I am trying to read a file This file has a line containing string 'disable = yes' I want to change this line to 'disable = no' The concern here is that , i plan to take into account the white spaces also. I tried copying all file int list and then tried to manipulate that list But the se

  1   2   >