Re: iterating over two arrays in parallel?

2008-08-29 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I want to interate over two arrays in parallel, something like this: a=[1,2,3] b=[4,5,6] for i,j in a,b: print i,j where i,j would be 1,4,2,5, 3,6 etc. Is this possible? How to fish for yourself: search 'Python loop two arrays parallel'

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread castironpi
On Aug 29, 12:29 am, W. eWatson [EMAIL PROTECTED] wrote: castironpi wrote: This gets you your list.  What do you mean by 'missing member of (a.dat, a.txt) is a pair. (None, a.txt) has a.dat missing. I just need to issue a msg to the user that one member of a file pair is missing. Both

Re: Multiple values for one key

2008-08-29 Thread Willi Richert
Hi, try defaultdict: In [1]: from collections import defaultdict In [2]: d=defaultdict(list) In [3]: d[1].append(7) In [4]: d[1].append(8) In [5]: d Out[5]: defaultdict(type 'list', {1: [7, 8]}) In [6]: d[1] Out[6]: [7, 8] Regards, wr Am Donnerstag 28 August 2008 19:02:55 schrieb Ron

Re: Tough Guy Competition

2008-08-29 Thread alex23
On Aug 29, 3:45 pm, W. eWatson [EMAIL PROTECTED] wrote: Something to do on your weekends. [non-related link clipped] Another thing to do with your weekends would be to -not spam-. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread Paul Rubin
W. eWatson [EMAIL PROTECTED] writes: [a.dat, c.dat, g.dat, k.dat, p.dat] [a.txt, b.txt, g.txt, k.txt r.txt, w.txt] What I need is to pair up items with the same prefix and use None, or some marker, to indicate the absence of the opposite item. This is functionally influenced but should be

Python-2.3.4 on OSF1 V4.0?

2008-08-29 Thread Ivo Raisr
Hi Edmond and any interested reader, I've successfully patched _socket extension of python 2.5.1 to build on OSF1 V4.0 with gcc 4.1.2. The following construct is put right after #include Python.h and #include structmember.h: #define _POSIX_PII_SOCKET #define _LIBC_POLLUTION_H_ Ivosh Raisr --

computer support

2008-08-29 Thread atrooja1998
hello every body in the group -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with list.insert

2008-08-29 Thread SUBHABRATA
Dear group, Thanx for your idea to use dictionary instead of a list. Your code is more or less, OK, some problems are there, I'll debug them. Well, I feel the insert problem is coming because of the Hindi thing. And Python2.5 is supporting Hindi quite fluently. I am writing in Python2.5.1. Best

Re: computer support

2008-08-29 Thread andrew
On 2008-08-29, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hello every body in the group Hello Dr Nick :-) -- http://www.andrews-corner.org -- http://mail.python.org/mailman/listinfo/python-list

u just click, u get some dollars

2008-08-29 Thread pavi
http://www.onlineincomess.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to write huge files

2008-08-29 Thread Tim Golden
Terry Reedy wrote: Mohamed Yousef wrote: let's say , I'm moving large files through network between devices what is the fastest way to do this ? what i came up with :- Use your OS's network copy command. On unix, that was once uucp. On Windows, I drag-and-drop to/from a Network

PyDoc in Windows Vista

2008-08-29 Thread Tyler Shopshire
I can't seem to access the pydoc sever from my web browser. I start the server from the command prompt and everything seems to be working fine, then I got to http://localhost:/ and it doesn't work. I also tried starting the graphical mode with the -g parameter but I still cannot use PyDoc.

PyDoc in Vista

2008-08-29 Thread Tyler Shopshire
I can't seem to get Pydoc up and running in windows Vista. I can search for modules manually by using the pydoc module_name command but if i try to set up an http server, it says the server is up and running but I can't access it in FF or IE. Any help is appreciated. --

Re: Syntax error in .py file and globals variable values not available.

2008-08-29 Thread Alexis Boutillier
Timothy Grant a écrit : On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier [EMAIL PROTECTED] wrote: Timothy Grant a écrit : On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier [EMAIL PROTECTED] wrote: Hi, I have a strange behaviour of python with pdb and import statement. Here is the example

Re: Checking if the file is a symlink fails

2008-08-29 Thread [EMAIL PROTECTED]
On Aug 28, 10:20 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Do you mean the following is deprecated ? http://docs.python.org/lib/module-stat.html From the documentation - S_ISLNK( mode)     Return non-zero if the mode is from a symbolic link. As that page

os.ChDir() not thread-safe; was : Is tempfile.mkdtemp() thread-safe?

2008-08-29 Thread Gabriel Rossetti
Gabriel Rossetti wrote: Hello, I'm using tempfile.mkdtemp() in a multithreading program and I've been having problems with it. Sometimes it tells me the file I'm trying to access (in the directory created with tempfile.mkdtemp()) doesn't exist. I suspect that tempfile.mkdtemp() returns the

microsoft terminal server

2008-08-29 Thread yqyq22
HI, i would like to know if there is a way to create a python script for automate mstsc.exe username and pwd credential, i mean i would create a script that first open mstsc.exe and in the same time is able to fill [computer+username+pwd]. Regards thanks a lot in advance --

Re: Python svn bindings for Subversion?

2008-08-29 Thread Mike B
On Thu, 28 Aug 2008 19:58:10 GMT, Matthew Woodcraft [EMAIL PROTECTED] wrote: Mike B writes: I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the following fails. from svn import fs, repos, core, delta [...] 'svn' appears to be a SWIG wrapper and could be what I'm

Re: subclassing complex

2008-08-29 Thread Patrick Maupin
On Aug 29, 12:17 am, BiDi [EMAIL PROTECTED] wrote: I have been trying to subclass complex, but I am not able to get the right-hand arithmetic operators working. As shown below, if an object of my subclass 'xcomplex' is added on the right of a 'comlex' object, the type returned is 'complex',

help needed with dictionary

2008-08-29 Thread lee
hi all, i am a newbie in python. i was trying to work with dictionaries. i wanted to input values through command line and store the values in a dictionary. i mean for the same key , multiple values. can any1 suggest me how can i do it.thank you i tried this, but the old value is

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Ken Starks
[EMAIL PROTECTED] wrote: x=[1,2,3] and x=[1,2,3,] are exactly the same, right? I'm generating some python data, and it's less error prone to not treat the last element specially, but I want to be sure I'm generating an equivalent data structure. Many TIA! Mark x=[1,2,3,] repr(x) [1,2,3]

Re: help needed with dictionary

2008-08-29 Thread Bruno Desthuilliers
lee a écrit : hi all, i am a newbie in python. i was trying to work with dictionaries. i wanted to input values through command line and store the values in a dictionary. i mean for the same key , multiple values. can any1 suggest me how can i do it.thank you i tried this, but the

Re: subclassing complex

2008-08-29 Thread Peter Otten
BiDi wrote: I have been trying to subclass complex, but I am not able to get the right-hand arithmetic operators working. As shown below, if an object of my subclass 'xcomplex' is added on the right of a 'comlex' object, the type returned is 'complex', not 'xcomplex'. I've tried

problem with execv command

2008-08-29 Thread dudeja . rajat
Hi, I'm facing problem with the execv command: my command is : os.execv(' C:\Program Files\Subversion\bin\svn ', ( 'list', ' \ http://subversion.stv.abc.com/svn/Eng \ ' ) ) The error I'm getting is : OSError: [Errno 22] Invalid argument I tried using a variable for http path but still I'm

Re: help needed with dictionary

2008-08-29 Thread Miles
On Fri, Aug 29, 2008 at 5:02 AM, lee wrote: i wanted to input values through command line and store the values in a dictionary. i mean for the same key , multiple values. http://mail.python.org/pipermail/python-list/2008-August/505509.html

class definition syntax

2008-08-29 Thread harryos
hi i have seen some class definitions like class MyClass(object): def __init__(self): what does the object keyword inside the braces in MyClass() mean? Has it got any significance? thanks in advance harry -- http://mail.python.org/mailman/listinfo/python-list

Re: class definition syntax

2008-08-29 Thread Diez B. Roggisch
harryos wrote: hi i have seen some class definitions like class MyClass(object): def __init__(self): what does the object keyword inside the braces in MyClass() mean? Has it got any significance? It indicates a so-called new-style-class. The new style classes have been

Re: microsoft terminal server

2008-08-29 Thread Tim Golden
[EMAIL PROTECTED] wrote: HI, i would like to know if there is a way to create a python script for automate mstsc.exe username and pwd credential, i mean i would create a script that first open mstsc.exe and in the same time is able to fill [computer+username+pwd]. Haven't tried it, but in

Re: problem with execv command

2008-08-29 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Hi, I'm facing problem with the execv command: my command is : os.execv(' C:\Program Files\Subversion\bin\svn ', ( 'list', ' \ http://subversion.stv.abc.com/svn/Eng \ ' ) ) The error I'm getting is : OSError: [Errno 22] Invalid argument I tried using a

Re: class definition syntax

2008-08-29 Thread Wojtek Walczak
On Fri, 29 Aug 2008 02:50:57 -0700 (PDT), harryos wrote: class MyClass(object): def __init__(self): what does the object keyword inside the braces in MyClass() mean? Has it got any significance? It's inheritance. MyClass class inherits from object class. Check out point 9.5

Re: PyImport_ImportModule deadlocks

2008-08-29 Thread Gabriel Genellina
En Thu, 28 Aug 2008 11:22:50 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribi�: I have an embedded Python shell and everything works fine, however, in my stdout catcher (in C to grab tracebacks) for some reason when I do a : PyImport_ImportModule( sys ) It deadlocks the process, is there

Iterating two arrays at once

2008-08-29 Thread mathieu
Hi there, just trying to figure out how to iterate over two array without computing the len of the array: A = [1,2,3] B = [4,5,6] for a,b in A,B: # does not work ! print a,b It should print: 1,4 2,5 3,6 Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating two arrays at once

2008-08-29 Thread Matthias Bläsing
Am Fri, 29 Aug 2008 03:35:51 -0700 schrieb mathieu: A = [1,2,3] B = [4,5,6] for a,b in A,B: # does not work ! print a,b It should print: 1,4 2,5 3,6 Hey, zip is your friend: for a,b in zip(A,B): print a,b does what you want. If you deal with big lists, you

Re: help needed with dictionary

2008-08-29 Thread lee
hi, thank you, ur code was helpful :) On Aug 29, 2:18 pm, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: lee a écrit : hi all, i am a newbie in python. i was trying to work with dictionaries. i wanted to input values through command line and store the values in a

Re: Iterating two arrays at once

2008-08-29 Thread Bruno Desthuilliers
mathieu a écrit : Hi there, just trying to figure out how to iterate over two array without computing the len of the array: A = [1,2,3] B = [4,5,6] for a,b in A,B: # does not work ! print a,b It should print: 1,4 2,5 3,6 for a, b in zip(A, B): print a, b or, using

Re: Iterating two arrays at once

2008-08-29 Thread mathieu
On Aug 29, 12:46 pm, Matthias Bläsing [EMAIL PROTECTED] aachen.de wrote: Am Fri, 29 Aug 2008 03:35:51 -0700 schrieb mathieu: A = [1,2,3] B = [4,5,6] for a,b in A,B: # does not work ! print a,b It should print: 1,4 2,5 3,6 Hey, zip is your friend: for a,b

problem with plotting

2008-08-29 Thread Anish Chapagain
hi, I'm getting problem with the code below which after displaying graph plotted in external window, doesnot closes itself, even after closing the window of plotting the main python window shows processing. code goes like this... plot(col1, col2, linewidth=1.0) xlabel('col1') ylabel('col2')

Re: class definition syntax

2008-08-29 Thread Ken Starks
harryos wrote: hi i have seen some class definitions like class MyClass(object): def __init__(self): what does the object keyword inside the braces in MyClass() mean? Has it got any significance? thanks in advance harry It is a syntax used for 'new type' classes, not so new

Re: class definition syntax

2008-08-29 Thread Bruno Desthuilliers
harryos a écrit : hi i have seen some class definitions like class MyClass(object): def __init__(self): what does the object keyword It's not a keyword. inside the braces in MyClass() mean? Answer is here:

Re: problem with plotting

2008-08-29 Thread [EMAIL PROTECTED]
On Aug 29, 6:01 am, Anish Chapagain [EMAIL PROTECTED] wrote: hi, I'm getting problem with the code below which after displaying graph plotted in external window, doesnot closes itself, even after closing the window of plotting the main python window shows processing. code goes like this...

Re: Iterating two arrays at once

2008-08-29 Thread Bruno Desthuilliers
mathieu a écrit : (snip solution) Thanks all ! FWIW, this has been discussed here *very* recently (a couple hours ago). Look for a thread named iterating over two arrays in parallel?, and pay special attention to Terry Reedy's answer. -- http://mail.python.org/mailman/listinfo/python-list

translating create Semaphore to Linux

2008-08-29 Thread GHUM
hello, in my application I am using hSem = win32event.CreateSemaphore (None, 1, 1,stringincludinginterfaceandport) rt=win32event.WaitForSingleObject (hSem, 0) if rt != win32event.WAIT_TIMEOUT: really_do_start_my_app() else: print application allready running to make sure that only ONE

Re: translating create Semaphore to Linux

2008-08-29 Thread Diez B. Roggisch
GHUM wrote: hello, in my application I am using hSem = win32event.CreateSemaphore (None, 1, 1,stringincludinginterfaceandport) rt=win32event.WaitForSingleObject (hSem, 0) if rt != win32event.WAIT_TIMEOUT: really_do_start_my_app() else: print application allready running to

Re: problem with plotting

2008-08-29 Thread Anish Chapagain
On Aug 29, 12:24 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 29, 6:01 am, Anish Chapagain [EMAIL PROTECTED] wrote: hi, I'm getting problem with the code below which after displaying graph plotted in external window, doesnot closes itself, even after closing the window of

Beginner's question about string's join() method

2008-08-29 Thread Macygasp
Hi, Can anybody tell me why and how this is working: ','.join(str(a) for a in range(0,10)) '0,1,2,3,4,5,6,7,8,9' I find this a little weird because join takes a sequence as argument; so, it means that somehow, from the str(a) ... expression, a sequence can be generated. If I write this:

Re: Python in a Nutshell -- Book vs Web

2008-08-29 Thread Cameron Laird
In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: Cameron Laird wrote: No. No, to an almost libelous extent. No matter what you write about, there's always a certain subcategory of potential readers who insist that collection, editing, filtering, structuring,

Re: Python in a Nutshell -- Book vs Web

2008-08-29 Thread Michele Simionato
On Aug 29, 1:44 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: Insightful.  Well, I find it insightful; perhaps it's a personal blindness on my part.  I expect programmers to understand, for example, that two lines of code can be a good day's production, in some circumstances My best days are

Re: translating create Semaphore to Linux

2008-08-29 Thread Francesco Bochicchio
On 29 Ago, 13:28, GHUM [EMAIL PROTECTED] wrote: hello, in my application I am using hSem = win32event.CreateSemaphore (None, 1, 1,stringincludinginterfaceandport) rt=win32event.WaitForSingleObject (hSem, 0) if rt != win32event.WAIT_TIMEOUT:    really_do_start_my_app() else:    print

Re: importing from .pyd

2008-08-29 Thread moijes12
On Jul 14, 4:11 pm, Kay Schluehr [EMAIL PROTECTED] wrote: On 14 Jul., 06:03, moijes12 [EMAIL PROTECTED] wrote: hi there is a .pyd file present in the same folder as the script abc.py by the name foo.pyd .I don't have foo.py .In the script abc.py I try import foo Error i get is

Re: translating create Semaphore to Linux

2008-08-29 Thread Tim Golden
GHUM wrote: hSem = win32event.CreateSemaphore (None, 1, 1,stringincludinginterfaceandport) rt=win32event.WaitForSingleObject (hSem, 0) if rt != win32event.WAIT_TIMEOUT: really_do_start_my_app() else: print application allready running to make sure that only ONE instance of the application

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Fett
On Aug 28, 7:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: So long story short: if I am expecting a dictionary of strings, I should make a parser that only accepts a dictionary of strings then. There is no safe way to use an existing construct. That is what I was afraid of. I know I will

Re: translating create Semaphore to Linux

2008-08-29 Thread GHUM
Tim, ... why use a Semaphore rather than a Mutex? as much as I understood the documentation at MSDN http://msdn.microsoft.com/en-us/library/ms686927(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms686946(VS.85).aspx a mutex seems to be nothing else than a special case of a semaphore?

Re: Beginner's question about string's join() method

2008-08-29 Thread Diez B. Roggisch
Macygasp wrote: Hi, Can anybody tell me why and how this is working: ','.join(str(a) for a in range(0,10)) '0,1,2,3,4,5,6,7,8,9' I find this a little weird because join takes a sequence as argument; so, it means that somehow, from the str(a) ... expression, a sequence can be

Re: translating create Semaphore to Linux

2008-08-29 Thread Tim Golden
GHUM wrote: Tim, ... why use a Semaphore rather than a Mutex? as much as I understood the documentation at MSDN http://msdn.microsoft.com/en-us/library/ms686927(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms686946(VS.85).aspx a mutex seems to be nothing else than a special case of

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread Boris Borcic
D,T=[dict((x.split('.')[0],x) for x in X) for X in (dat,txt)] for k in sorted(set(D).union(T)) : for S in D,T : print '%-8s' % S.get(k,'None'), print HTH W. eWatson wrote: Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Fett
On Aug 29, 7:42 am, Fett [EMAIL PROTECTED] wrote: On Aug 28, 7:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: So long story short: if I am expecting a dictionary of strings, I should make a parser that only accepts a dictionary of strings then. There is no safe way to use an existing

Re: Fastest way to write huge files

2008-08-29 Thread Mohamed Yousef
Thanks all , but there is still something i forget to state -sorry - all communication will be via Http with a server so data is received via Http so local network solutions won't work the problem really starts after receiving data in storing them without much of a CPU/Memory usage and with a good

Re: file data to list

2008-08-29 Thread Sion Arrowsmith
Emile van Sebille [EMAIL PROTECTED] wrote: data = zip(*[xx.split() for xx in open('data.txt').read().split(\n)]) Files are iterable: data = zip(*[xx.rstrip().split() for xx in open('data.txt')]) saves you creating the extra intermediate list resulting from split(\n). -- \S -- [EMAIL

Re: iterating over two arrays in parallel?

2008-08-29 Thread Cousin Stanley
I want to interate over two arrays in parallel, something like this: a=[1,2,3] b=[4,5,6] for i,j in a,b: print i,j where i,j would be 1,4,2,5, 3,6 etc. Is this possible? Many TIA! Mark list_1 = range( 1 , 4 ) list_2 = range( 4 , 7 ) list12 = zip(

Ensure only single application instance.

2008-08-29 Thread Heston James
Good afternoon all. I have an application/script which is launched by crontab on a regular basis. I need an effective and accurate way to ensure that only one instance of the script is running at any one time. After a short look around the internet I found a couple of examples, such as this

Re: Ensure only single application instance.

2008-08-29 Thread Alex
SOP is to write the actual PID of the running process into the pidfile, then check to a) that the pidfile exists, and b) that the process referenced in the pidfile exists. if the pidfile exists, but the process does not, take over the pidfile and carry on. On Fri, Aug 29, 2008 at 9:51 AM, Heston

Re: PyDoc in Windows Vista

2008-08-29 Thread Mike Driscoll
On Aug 28, 5:45 pm, Tyler Shopshire [EMAIL PROTECTED] wrote: I can't seem to access the pydoc sever from my web browser. I start the server from the command prompt and everything seems to be working fine, then I got tohttp://localhost:/and it doesn't work. I also tried starting the

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Roy Smith
Terry Reedy [EMAIL PROTECTED] wrote: Yes, so you can write something like either your second example or l = [ kjasldfjs, kjsalfj, ksjdflasj, ] and insert items without worrying about leaving out the comma (less of a problem with 'horizontal' list), or delete the last line and

Re: importing from .pyd

2008-08-29 Thread John Machin
On Jul 14, 9:11 pm, Kay Schluehr [EMAIL PROTECTED] wrote: On 14 Jul., 06:03, moijes12 [EMAIL PROTECTED] wrote: [snip] Error i get is ImportError: DLL load failed: The specified module could not be found. Notice that the message clearly indicates that Python found the module but failed to

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Bruno Desthuilliers
Fett a écrit : On Aug 28, 7:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: So long story short: if I am expecting a dictionary of strings, I should make a parser that only accepts a dictionary of strings then. or use an existing parser for an existing and documented format, as many

Re: Identifying the start of good data in a list

2008-08-29 Thread Jorgen Grahn
On 27 Aug 2008 15:50:14 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 26 Aug 2008 17:04:19 -0700, tdmj wrote: On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Grant Edwards
On 2008-08-29, Roy Smith [EMAIL PROTECTED] wrote: Exactly. This is one of those little pieces of syntactic sugar which makes python so nice to work with. The alternative is (in C, for example) abominations like this: const char* l[] = {foo , bar , baz

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Steven D'Aprano
On Fri, 29 Aug 2008 05:42:46 -0700, Fett wrote: On Aug 28, 7:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: So long story short: if I am expecting a dictionary of strings, I should make a parser that only accepts a dictionary of strings then. There is no safe way to use an existing

Python graphics question:pixel scrolling

2008-08-29 Thread Raymond Luxury-Yacht
To learn python, I've been trying to write a simple graphics program which displays a 1D cellular automaton's evolution. The last time I wrote this program, it was in C for a CGA adaptor (!) in which the display was mapped to two interlaced blocks of memory, and scrolling up two lines of pixels

Python - ubuntu

2008-08-29 Thread azrael
Hy folks A friend of mine told me something about Guido and google developing an Ubuntu distribution based and totaly oriented for the Python appliction development. I googled for it with no results. Is it possible that My Buddy is trying to foole me or is it possible that someone knows something

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Steven D'Aprano
On Thu, 28 Aug 2008 16:28:03 -0700, Paul McNett wrote: [EMAIL PROTECTED] wrote: x=[1,2,3] and x=[1,2,3,] are exactly the same, right? When confronted with this type of question, I ask the interpreter: {{{ mac:~ pmcnett$ python Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Roy Smith
In article [EMAIL PROTECTED], Grant Edwards [EMAIL PROTECTED] wrote: On 2008-08-29, Roy Smith [EMAIL PROTECTED] wrote: Exactly. This is one of those little pieces of syntactic sugar which makes python so nice to work with. The alternative is (in C, for example) abominations like this:

[no subject]

2008-08-29 Thread bruce
Hi. I'm using mechanize to parse a page/site that uses the meta http-equiv tag in order to perform a refresh/redirect of the page. I've tried a number of settings, and read different posts on various threads, but seem to be missing something. the test.html page is the page that the url returns,

python/mechanize - redirect/refresh question

2008-08-29 Thread bruce
Hi. I'm using mechanize to parse a page/site that uses the meta http-equiv tag in order to perform a refresh/redirect of the page. I've tried a number of settings, and read different posts on various threads, but seem to be missing something. the test.html page is the page that the url returns,

Module __file__ attribute in Python 3

2008-08-29 Thread Steven D'Aprano
On the python-dev mailing list, a question has be raised about a change to module.__file__ in Python 3. http://www.gossamer-threads.com/lists/python/dev/674923#674923 In Python 2.x, m.__file__ is the name of the file that the module was imported from. That file might end with .py, .pyc, .pyo,

Re: Python graphics question:pixel scrolling

2008-08-29 Thread Paul Boddie
On 29 Aug, 16:57, Raymond Luxury-Yacht [EMAIL PROTECTED] wrote:  The code below works, and uses pygame for the graphics.  But the scrolling is quite flickery when using large windows.  I'm sure that the code contains various neophyte python errors, and I'd appreciate any comments on that, but

Re: Python - ubuntu

2008-08-29 Thread Fredrik Lundh
azrael wrote: A friend of mine told me something about Guido and google developing an Ubuntu distribution based and totaly oriented for the Python appliction development. not sure about a version tuned for python, but wikipedia claims that there's a custom packaging used internally:

Re: Module __file__ attribute in Python 3

2008-08-29 Thread Jean-Paul Calderone
On 29 Aug 2008 15:21:53 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: On the python-dev mailing list, a question has be raised about a change to module.__file__ in Python 3. http://www.gossamer-threads.com/lists/python/dev/674923#674923 In Python 2.x, m.__file__ is the name of the file that

Re: Tkinter tkMessageBox problem - message box is displayed with an additional window

2008-08-29 Thread dudeja . rajat
On Thu, Aug 28, 2008 at 3:54 PM, Guilherme Polo [EMAIL PROTECTED] wrote: On Thu, Aug 28, 2008 at 10:29 AM, [EMAIL PROTECTED] wrote: Hi, I'm working on Windows Platform I'm facing some problem with the tkMessageBox. My code is as below: import tkMessageBox import Tix from Tkinter import *

How to check is something is a list or a dictionary or a string?

2008-08-29 Thread dudeja . rajat
Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values as strings or lists. So now, when I iterate this dictionary I want to

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Lie
On Aug 29, 8:14 pm, Fett [EMAIL PROTECTED] wrote: On Aug 29, 7:42 am, Fett [EMAIL PROTECTED] wrote: On Aug 28, 7:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: So long story short: if I am expecting a dictionary of strings, I should make a parser that only accepts a dictionary of

Re: Tough Guy Competition

2008-08-29 Thread W. eWatson
alex23 wrote: On Aug 29, 3:45 pm, W. eWatson [EMAIL PROTECTED] wrote: Something to do on your weekends. [non-related link clipped] Another thing to do with your weekends would be to -not spam-. Sorry, misdirected. -- W. Watson (121.015 Deg.

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread W. eWatson
I just tried the following code, and got an unexpected result. from pyfdate import * t = Time() ts = Time(2008, 8, 29,15,20,7) tnew = ts.plus(months=6) print new date: , tnew Result: new date: 2009-02-28 15:20:07 I believe that should be April 1, 2009. If I use months = 1 and day =31, I get

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread W. eWatson
castironpi wrote: ... I don't think that's guaranteed by anything. I realized that 'dat.sort()' and 'txt.sort()' weren't necessary, since their contents are moved to a dictionary, which isn't sorted. Actually, I'm getting the file names from listdir, and they appear to be sorted low to high.

Re: Sending e-mail

2008-08-29 Thread peter . jones . rpi
On Aug 28, 3:23 pm, gordyt [EMAIL PROTECTED] wrote: Peter here is an example. I just tried it and it works fine. from smtplib import SMTP HOST = smtp.gmail.com PORT = 587 ACCOUNT = # put your gmail email account name here PASSWORD = # put your gmail email account password here def

Re: Identifying the start of good data in a list

2008-08-29 Thread castironpi
On Aug 29, 9:43 am, Jorgen Grahn [EMAIL PROTECTED] wrote: On 27 Aug 2008 15:50:14 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 26 Aug 2008 17:04:19 -0700, tdmj wrote: On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then

Re: How to check is something is a list or a dictionary or a string?

2008-08-29 Thread Jason Scheirer
On Aug 29, 9:16 am, [EMAIL PROTECTED] wrote: Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues():             self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values as strings or

Re: Python graphics question:pixel scrolling

2008-08-29 Thread Diez B. Roggisch
Raymond Luxury-Yacht wrote: To learn python, I've been trying to write a simple graphics program which displays a 1D cellular automaton's evolution. The last time I wrote this program, it was in C for a CGA adaptor (!) in which the display was mapped to two interlaced blocks of memory, and

Re: problem with packages and path

2008-08-29 Thread Daniel
On Aug 28, 2:28 am, Marco Bizzarri [EMAIL PROTECTED] wrote: On Wed, Aug 27, 2008 at 6:44 PM, Daniel [EMAIL PROTECTED] wrote: Hello, I'm writing some unit tests for my python software which uses packages.  Here is the basic structure: mypackage  __init__.py  module1    __init__.py

Re: Module __file__ attribute in Python 3

2008-08-29 Thread Diez B. Roggisch
That will mean that there will be no (easy?) way to determine after the import whether the module was imported from a source file or a compiled file. I've suggested that the original justification for the patch no longer applies, and that the secondary purpose of the patch is better solved by

Re: Command lime code

2008-08-29 Thread Steven D'Aprano
On Fri, 29 Aug 2008 17:20:37 +0100, London wrote: I am new to python. I did find a page which listed some code - IE chdir type code but can not find it again. Can you supply an address? http://www.google.com is a good address to use. Seriously, did you think we've hacked your computer and

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread George Sakkis
On Aug 29, 1:29 am, W. eWatson [EMAIL PROTECTED] wrote: It looks like I have a few new features to learn about in Python. In particular, dictionaries. In Python it's hard to think of many non-trivial problems that you *don't* have to know about dictionaries. George --

Re: Tkinter event loop question

2008-08-29 Thread gordon
On Aug 29, 4:45 am, Russell E. Owen [EMAIL PROTECTED] wrote: your Controller object should not create root nor should it call mainloop to start the event loop. guys thanks for the helpful replies..I rewrote the code as you advised. It creates a controller object and a gui object from main

When to use try and except?

2008-08-29 Thread cnb
If I get zero division error it is obv a poor solution to do try and except since it can be solved with an if-clause. However if a program runs out of memory I should just let it crash right? Because if not then I'd have to write exceptions everywhere to prevent that right? So when would I

Re: How to check is something is a list or a dictionary or a string?

2008-08-29 Thread George Sakkis
On Aug 29, 12:16 pm, [EMAIL PROTECTED] wrote: Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values as strings or

Memory Leek, critique me. Thanks!!!

2008-08-29 Thread Kevin McKinley
# I posted a few days ago about a memory leak that I think i'm having with my first Tkinter program. # I've had trouble pinpointing what is wrong so i thought i would submit the code and see if anyone would # like to critique it. # I have one more problem that i can't figure out either.

Multipart - Counting the amount of Values for One key

2008-08-29 Thread Ron Brennan
hello, I am trying to find the amount of values there are pertaining to one key. For example: - To find the average of the values pertaining to the key. - Use the amount of values to calculate a histogram Also, how do reference a specific value for a key in a multipart? Thanks, Ron --

Re: When to use try and except?

2008-08-29 Thread Daniel
On Aug 29, 11:23 am, cnb [EMAIL PROTECTED] wrote: If I get zero division error it is obv a poor solution to do try and except since it can be solved with an if-clause. However if a program runs out of memory I should just let it crash right? Because if not then I'd have to write exceptions

Re: When to use try and except?

2008-08-29 Thread George Sakkis
On Aug 29, 1:23 pm, cnb [EMAIL PROTECTED] wrote: If I get zero division error it is obv a poor solution to do try and except since it can be solved with an if-clause. However if a program runs out of memory I should just let it crash right? Because if not then I'd have to write exceptions

Re: Tkinter event loop question

2008-08-29 Thread Russell E. Owen
In article [EMAIL PROTECTED], gordon [EMAIL PROTECTED] wrote: On Aug 29, 4:45 am, Russell E. Owen [EMAIL PROTECTED] wrote: your Controller object should not create root nor should it call mainloop to start the event loop. guys thanks for the helpful replies..I rewrote the code as you

  1   2   3   >