Re: Python internals question

2008-07-15 Thread Peter Anderson
Helmut Jarausch wrote: Please have a look at ... http://rg03.wordpress.com/2007/04/21/semantics-of-python-variable-names-from-a-c-perspective/ Helmut, I found the second reference (the one above) very useful thank you. Most other respondents to my original question did not seem to underst

Re: Python internals

2008-07-15 Thread Peter Anderson
Ben Finney wrote: Larry Bates <[EMAIL PROTECTED]> writes: The term "pointer" carries much extra baggage for a programmer thinking of C (as the original poster is)... Thanks everyone! Just a quick correction - "as the original poster is" is a bit of a jump that does not reflect my original qu

Re: Moving to functional programming

2008-07-15 Thread Terry Reedy
Ben Finney wrote: Paul Rubin writes: I don't like square-bracket listcomps because they leak the index variables to the outside. According to PEP 289 http://www.python.org/dev/peps/pep-0289>, this is an acknowledged wart that will be fixed in Python 3.0. Has bee

Re: new itertools functions in Python 2.6

2008-07-15 Thread Mensanator
On Jul 15, 1:44 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Jul 14, 1:26 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > ## Combinations with replacement > > ## - > > ## aaa aab aac aad aae abb abc abd abe acc acd ace > > ## add ade aee bbb bbc bbd bbe bcc

Redirecting stdout to another script

2008-07-15 Thread Richard Simões
Hopefully, this explanation will sufficiently clear despite the lack of code. I wrote a python script that takes data via stdin, does stuff with the data, and outputs the result to stdout. A friend wrote a perl script that opens a pipe to my script, feeds it data, and then accepts the result. The

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Martin v. Löwis
>> I need to know if I'm running on 32bit or 64bit ... so far I haven't >> come up with how to get this info via python. sys.platform returns >> what python was built on ... but not what the current system is. >> >> I thought platform.uname() or just platform.processor() would have >> done it, but

Re: Simplify Code

2008-07-15 Thread Alexandr N Zamaraev
header_sizes = (36, 26, 22, 18, 14, 12) if x not in header_sizes: raise Exception() else: h36, h26, h22, h18, h14, h12 = tuple( line if x == size else '' for x in header_sizes) -- http://mail.python.org/mailman/listinfo/python-list

reading one byte from stdin

2008-07-15 Thread Mark McDuff
I'm trying to read one byte from stdin, without the newline. If I try something like: >>> import os, sys >>> os.read(sys.stdin.fileno(),1) I can input a character, but then I have to press enter, which leaves a newline character in the stdin buffer and requires two keypresses. Is there any

Is there any library that can extract titles from PDFs?

2008-07-15 Thread ZelluX
Hi, all I want to write a script which will rename PDFs according to their titles. I want to know if there is any library that can extract titles(the first line of the PDF) from PDFs. Many thanks for your reply ;-) -- http://mail.python.org/mailman/listinfo/python-list

snippet to update local (bazaar, mercurial, svn) versioned source

2008-07-15 Thread Alia Khouri
Here's a very simple snippet I use to automatically keep my versioned sources fresh.. Posted here in case it may be of use to anybody... #!/usr/local/bin/python import os, sys src = '/Users/ak/Code/src' # utility functions join, isdir, listdir = os.path.join, os.path.isdir def run(cmd): pri

Re: how to match whole word

2008-07-15 Thread Gary Herron
Peng Yu wrote: Hi, The following code snippet is from /usr/bin/rpl. I would like the it to match a word, for example, "abc" in ":abc:". But the current one would not match "abc" in ":abc:". I tried to modify it myself. Would you please let me know what is the corrected way to do it? Thanks, Pen

Re: Modify a string's value

2008-07-15 Thread Ben Finney
[EMAIL PROTECTED] writes: > I just came across this unusual situation where I'd like to modify a > string passed to a function Again: Why? The normal way to do this is to create a new string and return that. > which seems impossible since Python passes arguments by value. No, Python passes argu

Re: Modify a string's value

2008-07-15 Thread s0suk3
On Jul 15, 6:46 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi everyone, > > > I've heard that a 'str' object is immutable. But is there *any* way to > > modify a string's internal value? > > > Thanks, > > Sebastian > > Why would you care? Just create a new string (wi

Re: iterator clone

2008-07-15 Thread Marc 'BlackJack' Rintsch
On Tue, 15 Jul 2008 19:54:30 -0700, Yosifov Pavel wrote: > Kay, can you show example of such generator? ReIter, for example, work > with usual generators. > > But for "big" iterator, I think is no any good solutions. IMHO we can > discern 2 types of iterators: re-startable (based on internal Pyth

ANN: Urwid 0.9.8.3 - Console UI Library

2008-07-15 Thread Ian Ward
Announcing Urwid 0.9.8.3 Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.8.3.tar.gz RSS: http://excess.org/feeds/tag/urwid/ About this release: === This is a maintenance release that fixes a memory leak and a

Is this correct behavior for default parameters?

2008-07-15 Thread Bruce Pearson
The first call to test has the file_list empty but on the second call to test the file_list is no longer empty but contains the values appended in the first call. Is this correct behavior? I'm using python 2.5 def test(param_1, file_list = []): if len(file_list) == 0: print "Em

how to match whole word

2008-07-15 Thread Peng Yu
Hi, The following code snippet is from /usr/bin/rpl. I would like the it to match a word, for example, "abc" in ":abc:". But the current one would not match "abc" in ":abc:". I tried to modify it myself. Would you please let me know what is the corrected way to do it? Thanks, Peng if opt

Re: Moving to functional programming

2008-07-15 Thread Ben Finney
Paul Rubin writes: > I don't like square-bracket listcomps because they leak the index > variables to the outside. According to PEP 289 http://www.python.org/dev/peps/pep-0289>, this is an acknowledged wart that will be fixed in Python 3.0. -- \“None can love

Re: About wmi

2008-07-15 Thread patrol
> At any rate, try using: > > result, = new_process.Terminate () Windows is sometime case insensitive,but the python is case sensitive. I also encountered this kind of problems. Thanks for Tim's help. Patrol -- http://mail.python.org/mailman/listinfo/python-list

Re: graphing lifelines

2008-07-15 Thread Larry Bates
E. J. Gold is the Hi-Tech Shaman wrote: On Jul 15, 3:38 pm, Larry Bates <[EMAIL PROTECTED]> wrote: Certainly a "Hi-Tech Shaman" can whip something up to do this, right? Yes, well E.J. Gold is the Hi-Tech Shaman. I'm Terrence Brannon, stating that fact :) So, maybe EJ could whip up such a th

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Larry Bates
David Lees wrote: [EMAIL PROTECTED] wrote: I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.process

Re: About wmi

2008-07-15 Thread patrol
> http://timgolden.me.uk/wmi-project/wmi.py It cannot work either. > which is a copy of the svn trunk to see if that > improves the UnicodeDecode error, please? I'll > try to get an install of a non-English edition of > Windows but, as you might imagine, I normally run > the UK version so don't h

Re: iterator clone

2008-07-15 Thread Yosifov Pavel
Kay, can you show example of such generator? ReIter, for example, work with usual generators. But for "big" iterator, I think is no any good solutions. IMHO we can discern 2 types of iterators: re-startable (based on internal Python objects) and not re-startable (with an external state, side- effe

Re: Moving to functional programming

2008-07-15 Thread Paul Rubin
James Fassett <[EMAIL PROTECTED]> writes: > tuple_list = ( > ('John', 'Doe'), > ('Mark', 'Mason'), > ('Jeff', 'Stevens'), > ('Bat', 'Man') > ) > # the final functional way > [result_list, _] = zip(*tuple_list) That's really ugly IMO. I'd use: result_list = list(x for (x,y) in

Re: graphing lifelines

2008-07-15 Thread E. J. Gold is the Hi-Tech Shaman
On Jul 15, 3:38 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > Certainly a "Hi-Tech Shaman" can whip something up to do this, right? > Yes, well E.J. Gold is the Hi-Tech Shaman. I'm Terrence Brannon, stating that fact :) So, maybe EJ could whip up such a thing :) I like the sci.math answer I go

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread David Lees
[EMAIL PROTECTED] wrote: I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.processor() would have don

Re: Testing for connection to a website

2008-07-15 Thread Alexnb
Timothy Grant wrote: > > On Tue, Jul 15, 2008 at 3:48 PM, Alexnb <[EMAIL PROTECTED]> wrote: > >> >> >> >> Alexnb wrote: >> > >> > Okay, I already made this post, but it kinda got lost. So anyway I need >> to >> > figure out how to test if the user is able to connect to a specific >> > website.

Re: Testing for connection to a website

2008-07-15 Thread Timothy Grant
On Tue, Jul 15, 2008 at 3:48 PM, Alexnb <[EMAIL PROTECTED]> wrote: > > > > Alexnb wrote: > > > > Okay, I already made this post, but it kinda got lost. So anyway I need > to > > figure out how to test if the user is able to connect to a specific > > website. Last time I got pointed to the urllib2

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread John Machin
On Jul 16, 6:10 am, [EMAIL PROTECTED] wrote: > I need to know if I'm running on 32bit or 64bit ... so far I haven't > come up with how to get this info via python. sys.platform returns > what python was built on ... but not what the current system is. > > I thought platform.uname() or just platform

Re: Suggestion: Python global scope

2008-07-15 Thread alex23
Anonymous Bastard wrote: > In Python, declaring a variable using the global statement automatically > makes it available in all subsequent scopes. > > But to me, it makes more sense to use the global statement to 'import' a > variable from the global scope into the current scope. My understanding

Re: Modify a string's value

2008-07-15 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi everyone, I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? Thanks, Sebastian Why would you care? Just create a new string (with the changed contents) and let garbage collection take care of the old one when

Re: Python for Kids

2008-07-15 Thread Michiel Overtoom
Sean wrote... > Pretty cool!! Our base will be *much* bigger in about twenty years. > I remember doing Basic on my dads Apple IIe. Gee, I wish Python existed back then. I had to endure Commore Basic on the PET2001. The biggest challenge was how to fit the program in 8K... It didn't take me long

Re: Python internals

2008-07-15 Thread Larry Bates
Ben Finney wrote: Larry Bates <[EMAIL PROTECTED]> writes: Names are pointers in Python that point to values in memory. The term "pointer" carries much extra baggage for a programmer thinking of C (as the original poster is). Python names give no access to the "address" of the value, and don't

Re: Is re.findall guaranteed to be "in order?"

2008-07-15 Thread MRAB
On Jul 15, 11:07 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > I tried looking through re.py and sre_compile.py, but I can't really see an > answer to my question. > > Experimenting has shown me that re.findall() will return a list with the > matches in the order it found them.  Am I lucky so far,

Re: How to package a logging.config file?

2008-07-15 Thread Vinay Sajip
On Jul 15, 3:04 pm, Matthew Wilson <[EMAIL PROTECTED]> wrote: > On Mon 14 Jul 2008 09:25:19 AM EDT, Vinay Sajip wrote: > > > Is your package a library or an application? If it's a library, you > > should avoid configuringloggingusing a config file - this is because > >loggingconfiguration is proces

Re: One step up from str.split()

2008-07-15 Thread Joel Koltner
"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What's wrong with sys.argv ? Mainly that it doesn't exist. :-) The example was slightly contrived -- I'm really dealing with commands interactively entered within a program in response to raw_input(), although the

Re: Logging to different addressees

2008-07-15 Thread Vinay Sajip
On Jul 15, 5:17 pm, McA <[EMAIL PROTECTED]> wrote: > > If you added the admin sink handler to the root logger, you're done. > > Isn't that the first thing above? What do you mean? I gave you a choice - to add the handler to the admin_logger OR the root logger. So I am saying here that if you added

Re: bad recursion, still works

2008-07-15 Thread Michael Torrie
iu2 wrote: > I still don't understand: In each recursive call to flatten, acc > should be bound to a new [], shouldn't it? Why does the binding happen > only on the first call to flatten? Nope. In each new call it's (re)bound to the same original list, which you've added to as your function conti

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Larry Bates
[EMAIL PROTECTED] wrote: I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.processor() would have don

Re: Testing for connection to a website

2008-07-15 Thread Alexnb
Alexnb wrote: > > Okay, I already made this post, but it kinda got lost. So anyway I need to > figure out how to test if the user is able to connect to a specific > website. Last time I got pointed to the urllib2 page, but if I do > urlopen() and and am not connected, the program stops. So I do

Re: Python internals

2008-07-15 Thread Ben Finney
Larry Bates <[EMAIL PROTECTED]> writes: > Names are pointers in Python that point to values in memory. The term "pointer" carries much extra baggage for a programmer thinking of C (as the original poster is). Python names give no access to the "address" of the value, and don't need to be "de-refe

Re: Modify a string's value

2008-07-15 Thread MRAB
On Jul 15, 3:06 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I've heard that a 'str' object is immutable. But is there *any* way to > > modify a string's internal value? > > If there were, it would not be immutable. The 'str' type has only > immutable values. > > You co

Re: Python internals

2008-07-15 Thread MRAB
On Jul 15, 2:50 pm, Peter Anderson <[EMAIL PROTECTED]> wrote: > Hi!  I am slowly teaching myself Python.  I was reading David Beazley's > excellent book "Python - Essential Reference"; in particular about > variables.  Let me quote: > > "Python is a dynamically typed language in which names can rep

Is re.findall guaranteed to be "in order?"

2008-07-15 Thread Joshua Kugler
I tried looking through re.py and sre_compile.py, but I can't really see an answer to my question. Experimenting has shown me that re.findall() will return a list with the matches in the order it found them. Am I lucky so far, or does the _sre.c's logic dictate the items will be added in order fo

Problem with MySQLdb and mod_python

2008-07-15 Thread Cyril Bazin
Hi, I installed an apache server with mod_python. I have got a problem with the mysql connection of my python script. In fact I tried this file : - import os os.environ["PYTHON_EGG_CACHE"] = "/tmp" import MySQLdb from mod_python import apache def test(req): db

Re: Need Python Programmer (preferentially in Los Angeles)

2008-07-15 Thread Michael J. Yanowitz
Hello: I think I can do it but would like more details. I have been doing GUI work for years. I have been doin Python only for the last 2 and 1/2 years. The GUI work I have done there has been with TkInter and wxPython. Thanks: Michael Yanowitz --- On Tue, 7/15/08, robnhood00 <[EMAIL PROTEC

Re: Measure class, precision, significant digits, and divmod()

2008-07-15 Thread Ethan Furman
Ken Starks wrote: Ethan Furman wrote: Hey all. As I have mentioned before, I am making this Measure class for two reasons: experience with unit testing, I like playing with numbers, I am unaware of anything like this having yet been done (okay, three reasons ;). Any and all fee

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Fredrik Lundh
Jerry Hill wrote: This is just plain untrue. If 'name is None' evaluates to true, then the variable 'name' is bound to the singleton value None. It has nothing to do with allocated memory or null pointers. All it means is that someplace along the line you did the equivalent of 'name = None' i

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Fredrik Lundh
Victor Noagbodji wrote: Well that's exactly why I'm asking. Since None returns False in if statements. Why do people use if name is not None: instead of simply writing if not name? Because they want to distinguish between None and other values that evaluate to False, of course. As the page I

Re: Using McMillan Installer, PyInstall or py2exe cross-platform?

2008-07-15 Thread Hartmut Goebel
David Lyon schrieb: there is a python based "bake" make like program... that is useful... http://projects.bertram-scharpf.de/bake/bake1.html I'm not in the need of a build program :-) I would use Scons therefor, anyway. then there is Wine... that is a windows emulator under linux... that m

Re: Measure class, precision, significant digits, and divmod()

2008-07-15 Thread Ken Starks
Ethan Furman wrote: Hey all. As I have mentioned before, I am making this Measure class for two reasons: experience with unit testing, I like playing with numbers, I am unaware of anything like this having yet been done (okay, three reasons ;). Any and all feedback welcome, particu

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Terry Reedy
Andreas Tawn wrote: I think a better explanation is that in your original function, x only existed while the for loop was running. As soon as execution hit the break statement, x ceased to exist. Wrong. For loop variables continue after the loop exits. This is intentional. Mensanator gav

Re: Modify a string's value

2008-07-15 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Hi everyone, I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? In 3.0, ascii chars and encoded unicode chars in general can be stored in a mutable bytearray. -- http://mail.python.org/mailman/listinfo/python-l

Need Python Programmer (preferentially in Los Angeles)

2008-07-15 Thread robnhood00
I need a python programmer that can integrate graphics into an existing python application. The application is a basic application and the job should be pretty easy for an experienced Python programmer. Los Angeles programmer is preferred but this can obviously be done from anywhere. Please conta

Re: Python internals

2008-07-15 Thread Terry Reedy
Peter Anderson wrote: Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book "Python - Essential Reference"; in particular about variables. Let me quote: "Python is a dynamically typed language in which names can represent values of different types during th

Re: bad recursion, still works

2008-07-15 Thread mdsherry
On Jul 15, 4:12 pm, iu2 <[EMAIL PROTECTED]> wrote: > On Jul 15, 9:30 pm, [EMAIL PROTECTED] wrote: > > > > > On Jul 15, 2:59 pm, iu2 <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I wrote this wrong recursive function that flattens a list: > > > > def flatten(lst, acc=[]): > > >     #print 'acc =',

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Benjamin Kaplan
On Tue, Jul 15, 2008 at 4:10 PM, <[EMAIL PROTECTED]> wrote: > I need to know if I'm running on 32bit or 64bit ... so far I haven't > come up with how to get this info via python. sys.platform returns > what python was built on ... but not what the current system is. > > I thought platform.uname()

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Jerry Hill
On Tue, Jul 15, 2008 at 4:13 PM, Reedick, Andrew <[EMAIL PROTECTED]> wrote: > If name is None: >Then name is NULL, nothing, nada, no object, no memory allocated, a > NULL pointer This is just plain untrue. If 'name is None' evaluates to true, then the variable 'name' is bound to the singleton

RE: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Tuesday, July 15, 2008 4:13 PM > To: Victor Noagbodji; python-list@python.org > Subject: RE: 'if name is not None:' v. 'if name:' > > If name: > Then either >

Re: Simplify Code

2008-07-15 Thread Terry Reedy
Victor Subervi wrote: I set the following variables: # Headers are kept in order to determine nesting of chapters # They are labeled according to font size h36 = '' h26 = '' h22 = '' h18 = '' h14 = '' h12 = '' header_sizes = [36, 26, 22, 18, 14, 12] # Size is the font size of the header size =

Re: bad recursion, still works

2008-07-15 Thread iu2
On Jul 15, 9:30 pm, [EMAIL PROTECTED] wrote: > On Jul 15, 2:59 pm, iu2 <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I wrote this wrong recursive function that flattens a list: > > > def flatten(lst, acc=[]): > >     #print 'acc =', acc, 'lst =', lst > >     if type(lst) != list: > >         acc.a

How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread kjhishere
I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.processor() would have done it, but python returns an

RE: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Victor Noagbodji > Sent: Tuesday, July 15, 2008 3:44 PM > To: python-list@python.org > Subject: Re: 'if name is not None:' v. 'if name:' > > >>what's the difference between these two statement

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Matimus
On Jul 15, 12:44 pm, "Victor Noagbodji" <[EMAIL PROTECTED]> wrote: > >>what's the difference between these two statement? > >one checks if the given object is not None, the other checks if it's a true > >value: > >http://docs.python.org/ref/Booleans.html#Booleans > >>And which one should one use?

Re: Testing for connection to a website

2008-07-15 Thread Larry Bates
Alexnb wrote: Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to connect to a specific website. Last time I got pointed to the urllib2 page, but if I do urlopen() and and am not connected, the program stops. So I don't know if

RE: graphing lifelines

2008-07-15 Thread Brock Massel
Google this: "drawing graphs with dot" dotguide.pdf Look at page ~40ff. Perhaps a simple script to generate graphviz input. Then let those excellent tools do the heavy lifting. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of E. J. Gold is the Hi-Tec

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Jeffrey Froman
Victor Noagbodji wrote: > Why do people use if name is not None: instead of simply > writing if not name? To differentiate from the case where name == '', or some other non-None false value. So the question is, do you want to test for identity with None, or for truth in general? Jeffrey -- http

Re: How can I save command prompt screen

2008-07-15 Thread Terry Reedy
Ty hensons wrote: how can i save my command prompt screen? On Windows, 2.4?+, right click upper left snake symbol, Edit/Select all (or Mark and select part), (not ^C as everywhere else -- thank MS for not following its standard) to save to clipboard. Then paste into notepad or whatever.

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Russell Blau
"Victor Noagbodji" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Well that's exactly why I'm asking. Since None returns False in if > statements. Why do people use if name is not None: instead of simply > writing if not name? > Because '' is a string value that is treated as fal

Re: Testing for connection to a website

2008-07-15 Thread Grant Edwards
On 2008-07-15, Alexnb <[EMAIL PROTECTED]> wrote: > Okay, I already made this post, but it kinda got lost. No, it didn't get lost. Your question was answered and you didn't like the answer. > So anyway I need to figure out how to test if the user is able > to connect to a specific website. Last

Re: Testing for connection to a website

2008-07-15 Thread Jordan
On Jul 15, 3:43 pm, Alexnb <[EMAIL PROTECTED]> wrote: > Okay, I already made this post, but it kinda got lost. So anyway I need to > figure out how to test if the user is able to connect to a specific website. > Last time I got pointed to the urllib2 page, but if I do urlopen() and and > am not con

Re: How can I save command prompt screen

2008-07-15 Thread Jordan
Let me take a stab: I figure you either want to save something that is showing up in the standard output in which case you can: instead of using the print command to print to standard output, open a file and append to that instead of printing, and then you can open that up when you are done and s

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Larry Bates
Rob Wolfe wrote: Larry Bates <[EMAIL PROTECTED]> writes: Can multiple applications send SocketHandler logging records to the same socket server on the same port simultaneously? Of course they can. Server can accept requests from many clients. You have used `SocketServer.ThreadingTCPServer`.

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Victor Noagbodji
>>what's the difference between these two statement? >one checks if the given object is not None, the other checks if it's a true >value: >http://docs.python.org/ref/Booleans.html#Booleans >>And which one should one use? >depends on what you want to test for, of course. > > Well that's exactly wh

Testing for connection to a website

2008-07-15 Thread Alexnb
Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to connect to a specific website. Last time I got pointed to the urllib2 page, but if I do urlopen() and and am not connected, the program stops. So I don't know if that was what y

Re: graphing lifelines

2008-07-15 Thread Larry Bates
E. J. Gold is the Hi-Tech Shaman wrote: (crossposted to sci.math) I'm looking for a tool which will take a dataset of tuples indicating the year of birth and death of a person: (1872, 1950, "Sri Aurobindo") (1821, 1910, "Mary Baker Eddy") (1831, 1891, "HP. Blavatksy") And graph them out, in ba

Re: graphing lifelines

2008-07-15 Thread Jordan
There are several different modules for graphing in Python which you can find easily by searching, but to my knowledge none of them will simply take in a set of tuples and turn them into what you want, although I am sure that it is certainly possible to program a app that could do that for you...

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Rob Wolfe
Larry Bates <[EMAIL PROTECTED]> writes: > Can multiple applications send SocketHandler logging records to the > same socket server on the same port simultaneously? Of course they can. Server can accept requests from many clients. You have used `SocketServer.ThreadingTCPServer`. That server for

Re: bad recursion, still works

2008-07-15 Thread mdsherry
On Jul 15, 2:59 pm, iu2 <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote this wrong recursive function that flattens a list: > > def flatten(lst, acc=[]): >     #print 'acc =', acc, 'lst =', lst >     if type(lst) != list: >         acc.append(lst) >     else: >         for item in lst: >             f

RE: need ldap windows binary and/or installation help

2008-07-15 Thread Sells, Fred
well, duh ;) as my granny used to say "If it had been a snake it would a bit ya". I could probably come up with some lame excuse why I didn't see the msi on osuch.org, but it would be lame and an excuse. anyway. Thanks! > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL

Re: MySQL Insert

2008-07-15 Thread maestroQC
Thanks for the information. However I must stick to decimal since I'm dealing with monetary values. I loose the decimals with int and float has only supports one decimal place. I tried as you suggested to use the %s instead of the %d to no avail. -- http://mail.python.org/mailman/listinfo/python-l

Re: Python embedding question.

2008-07-15 Thread Jan Claeys
Op Tue, 15 Jul 2008 11:51:47 +0200, schreef Thomas Troeger: > I want to embed a Python application on a device with limited > resources, esp. storage limitations. Is there a way to reduce the Python > interpreter to a set of modules that's urgently needed? You might want to have a look at how the

Re: Testing for Internet Connection

2008-07-15 Thread Grant Edwards
On 2008-07-15, norseman <[EMAIL PROTECTED]> wrote: > Process: > copy/paste into afile > slide lines left to create proper indent values > save > python afile > > I get same as Grant > > > If one does a copy/paste into interactive Python, it does fail. > (Lots of indent error messages. After all,

Re: Python internals

2008-07-15 Thread Jan Claeys
Op Tue, 15 Jul 2008 09:29:58 -0500, schreef Larry Bates: > Names are pointers in Python that point to values in memory. But "pointers" doesn't have the same meaning as in "C" here. Memory in Python is not (necessarily) an "array of bytes"; how & where the values are stored in "physical memory"

bad recursion, still works

2008-07-15 Thread iu2
Hi, I wrote this wrong recursive function that flattens a list: def flatten(lst, acc=[]): #print 'acc =', acc, 'lst =', lst if type(lst) != list: acc.append(lst) else: for item in lst: flatten(item) return acc a = [1, 2, [3, 4, 5], [6, [7, 8, [9, 10],

graphing lifelines

2008-07-15 Thread E. J. Gold is the Hi-Tech Shaman
(crossposted to sci.math) I'm looking for a tool which will take a dataset of tuples indicating the year of birth and death of a person: (1872, 1950, "Sri Aurobindo") (1821, 1910, "Mary Baker Eddy") (1831, 1891, "HP. Blavatksy") And graph them out, in bars, annotating them with the person's name

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Fredrik Lundh
Victor Noagbodji wrote: what's the difference between these two statement? one checks if the given object is not None, the other checks if it's a true value: http://docs.python.org/ref/Booleans.html#Booleans > And which one should one use? depends on what you want to test for, of cour

Re: MySQL Insert

2008-07-15 Thread Ethan Furman
maestroQC wrote: Hi, Its one of those days. I cannot solve this. Any help would be greatly appreciated! When I execute this: class Db(object): def insertAccount(self, date, accountNumber, description, openingBalance): dec = decimal.Decimal(openingBalance) db = MySQLdb.connec

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Larry Bates
Victor Noagbodji wrote: Hello, what's the difference between these two statement? And which one should one use? if name ... Will be false if: name is an integer == 0 name is a float == 0 name is an empty string name is an empty list name is an empty dictionary There are others, but you get

Re: need ldap windows binary and/or installation help

2008-07-15 Thread Michael Ströder
Tim Golden wrote: Sells, Fred wrote: I'm running python 2.5 (or 2.4) in an XP environment. I downloaded and installed the .dll's from OpenLDAP-2.4.8+OpenSSL-0.9.8g-Win32.zip and copied the .dll's in c:/windows/system32 as instructed now I get this error. Is there anyway to avoid building the

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread J. Cliff Dyer
On Tue, 2008-07-15 at 14:37 -0400, Victor Noagbodji wrote: > Hello, > > what's the difference between these two statement? And which one should one > use? > Aside: Please include all relevant information in the *body* of your post, not just the subject header. The two statements in question a

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread norseman
Mensanator wrote: On Jul 15, 12:36 pm, defn noob <[EMAIL PROTECTED]> wrote: On Jul 15, 7:28 pm, Mensanator <[EMAIL PROTECTED]> wrote: On Jul 15, 11:26 am, defn noob <[EMAIL PROTECTED]> wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it

Re: Testing for Internet Connection

2008-07-15 Thread norseman
Grant Edwards wrote: On 2008-07-15, Alexnb <[EMAIL PROTECTED]> wrote: What exactly do you think will work? I am not sure what you think I should do? If I use urlopen("http://www.google.com";) and I am not connected, I am not going to get an exception, the program will fail. Bullshit. You ge

'if name is not None:' v. 'if name:'

2008-07-15 Thread Victor Noagbodji
Hello, what's the difference between these two statement? And which one should one use? -- NOAGBODJI Paul Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Mensanator
On Jul 15, 12:36 pm, defn noob <[EMAIL PROTECTED]> wrote: > On Jul 15, 7:28 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > > > > On Jul 15, 11:26 am, defn noob <[EMAIL PROTECTED]> wrote: > > > > isPrime works when just calling a nbr but not when iterating on a > > > list, why? adding x=1 makes i

Re: Testing for Internet Connection

2008-07-15 Thread Grant Edwards
On 2008-07-15, Alexnb <[EMAIL PROTECTED]> wrote: > What exactly do you think will work? I am not sure what you > think I should do? If I use urlopen("http://www.google.com";) > and I am not connected, I am not going to get an exception, > the program will fail. Bullshit. You get an exception. H

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Sparky
On Jul 15, 11:38 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Sparky wrote: > > Hello! I am writing some software that will have many users accessing > > the same file resource at once for reading purposes only. I am > > programming on (Ubuntu) Linux and my question is in Windows, can I > > have it

Re: Pickle and wx.TextCtrl

2008-07-15 Thread DWebre
D. J. Webre, Jr. PE & PLS "Gabriel Genellina" <[EMAIL PROTECTED]

Re: Is it legal to rebuild Python.exe to include Version property tab?

2008-07-15 Thread Sebastian "lunar" Wiesner
[EMAIL PROTECTED] <[EMAIL PROTECTED]>: > My company distributes a COM object that can be license and userd by > our customers. Some of my company's internal application also use the > COM object. However, for internal applications, instead of licensing > the COM object, we just make the applicatio

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Alex Marandon-3 wrote: > > Alexnb wrote: >> I am wondering, is there a simple way to test for Internet connection? If >> not, what is the hard way :p > > Trying to fetch the homepage from a few major websites (Yahoo, Google, > etc.)? If all of them are failing, it's very likely that the conne

  1   2   3   >