Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread John Machin
On Jan 30, 5:24 pm, r wrote: [snip] > This blows me away in the context of this group. check out this > thread:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > Here a happy python user shared his thoughts on the Python language. > He compared Python as "more readable" t

Re: parsing text from a file

2009-01-30 Thread Tim Golden
Wes James wrote: If I read a windows registry file with a line like this: "{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted Multicast|Edge=FALSE|" Watch out. .reg

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread r
On Jan 30, 2:26 am, John Machin wrote: [snip] > This doesn't appear to match the description. Perhaps the PSU has > subverted my comp)(*&^...@! > NO CARRIER Oops -- Good catch John, Even perfect people like myself make mistakes :). Here is the aforementioned thread where a Python user was chastis

Re: Why doesn't eval of generator expression work with locals?

2009-01-30 Thread Peter Otten
Gabriel Genellina wrote: > But a loop doesn't define a new scope (only "def" and "class" used to > define one; now generator expressions do too). The new scope is not the > issue, but the fact that the right and left parts of a gen.expr. are > evaluated at different times. This wasn't obvious to m

Re: search speed

2009-01-30 Thread Diez B. Roggisch
anders schrieb: Hi! I have written a Python program that serach for specifik customer in files (around 1000 files) the trigger is LF01 + CUSTOMERNO So a read all fils with dirchached Then a loop thru all files each files is read with readLines() and after that scaned Today this works fine, it

Re: ImportError in embedded Python Interpreter

2009-01-30 Thread googler . 1 . webmaster
Hi! Thanks. Well, os.py is found and all the others which don't need a library. I tested this: I execute Py_Main(...) in my app which executes the console interpreter and i tried to execute "import socket" which works. So Py_Main has something what my created PyRun_SimpleString doesn't have. Ma

Re: 'Address already in use' ... with TCPServer

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 05:43:33 -0200, Mabooka-Mabooka Mbe-Mbe escribió: setsockopt(REUSEADDR)... What I came up with so far is this: from SocketServer import * s = TCPServer( ('', 32123), None) dir(s) ['RequestHandlerClass', '__doc__', '__init__', '__module__', 'address_family', 'allow_re

Re: parsing text from a file

2009-01-30 Thread John Machin
On Jan 30, 7:39 pm, Tim Golden wrote: > Wes James wrote: > > If I read a windows registry file with a line like this: > > > "{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program > > Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk

Re: Why doesn't eval of generator expression work with locals?

2009-01-30 Thread Hendrik van Rooyen
"Gabriel Genellina" wrote: Of course this is clearly stated in the Language Reference "Variables used in the generator expression are evaluated lazily in a separate scope when the next() method is called for the generator object (in the same fashion as for normal generators). However, the in expr

Re: ImportError in embedded Python Interpreter

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 06:54:56 -0200, escribió: Thanks. Well, os.py is found and all the others which don't need a library. I tested this: I execute Py_Main(...) in my app which executes the console interpreter and i tried to execute "import socket" which works. So Py_Main has something what

Re: ImportError in embedded Python Interpreter

2009-01-30 Thread googler . 1 . webmaster
Hi! Okay, thats just the question. I did that what you wrote but it doesn't really works. What is, if Py_SetProgramName() gets a NULL Pointer, if argv[0] is empty? Well, the problem is, in my opinion that os.environ returns some paths in python.exe and in my embedded interpreter if I call os.envi

Re: Get thread pid

2009-01-30 Thread Ove Svensson
Alejandro writes: > Hi: > > I have Python program running under Linux, that create several > threads, and I want to now the corresponding PID of the threads. > > In each of the threads I have > > def run(self): > pid = os.getpid() > logger.critical('process ID: %s', pid) > > However, the

Re: Rounding to the nearest 5

2009-01-30 Thread Tim Chase
Steven D'Aprano wrote: On Thu, 29 Jan 2009 18:26:34 -0600, Tim Chase wrote: How can you make python round numbers to the nearest 5: Example: 3 => 0 8 => 10 23.2 => 20 36 => 35 51.5 => 50 I'm not sure *any* rounding system will give those results. Round towards zero. 8 => 10 ? One ca

Re: py2exe + SQLite problem

2009-01-30 Thread Armin
Gabriel Genellina wrote: En Thu, 29 Jan 2009 13:05:11 -0200, Armin escribió: I have frozen a running application which is using SQLite with py2exe. When I start the exe file I see in the log file of the exe: Traceback (most recent call last): File "dpconf.py", line 666, in ? File "dpconf

Noob question

2009-01-30 Thread nanoeyes
Hello? I'm currently installed Ubuntu 8.10. I'm not a Linux person, so I don't know a lot about it. The reason I installed Ubuntu is just for EMAN (http://blake.bcm.tmc.edu/eman/). EMAN 1.8 software requires Python 2.4 not 2.5 which comes with Ubuntu 8.10. I installed Python 2.4 by typing sudo apt

Re: 'Address already in use' ... with TCPServer

2009-01-30 Thread Giampaolo Rodola'
On 30 Gen, 10:16, "Gabriel Genellina" wrote: > En Fri, 30 Jan 2009 05:43:33 -0200, Mabooka-Mabooka Mbe-Mbe   > escribió: > > >   setsockopt(REUSEADDR)... > > > What I came up with so far is this: > from SocketServer import * > s = TCPServer( ('', 32123), None) > dir(s) > > ['Reques

Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
Hi all, Suppose I've the entries like the following in my file: -- 116.52.155.237:80 ip-72-55-191-6.static.privatedns.com:3128 222.124.135.40:80 217.151.231.34:3128 202.106.121.134:80 211.161.197.182:80 hpc.be.itu.edu.tr:80 static3-117-183.worldinternetworkcorporation.com:80 -

ANN: eGenix pyOpenSSL Distribution 0.8.0-0.9.8j-1

2009-01-30 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.8.0-0.9.8j-1 An easy to install and use repackaged distribution of the pyOpenSSL Python interfa

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Chris Rebert
On Fri, Jan 30, 2009 at 4:27 AM, Hongyi Zhao wrote: > Hi all, > > Suppose I've the entries like the following in my file: > > -- > 116.52.155.237:80 > ip-72-55-191-6.static.privatedns.com:3128 > 222.124.135.40:80 > 217.151.231.34:3128 > 202.106.121.134:80 > 211.161.197.182:80 > hpc

Re: 'Address already in use' ... with TCPServer

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 10:16:42 -0200, Giampaolo Rodola' escribió: On 30 Gen, 10:16, "Gabriel Genellina" wrote: En Fri, 30 Jan 2009 05:43:33 -0200, Mabooka-Mabooka Mbe-Mbe   escribió: >   setsockopt(REUSEADDR)... s.allow_reuse_address=1 > should do the trick. It's too late then; bind()

Re: 'Address already in use' ... with TCPServer

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 10:16:42 -0200, Giampaolo Rodola' escribió: On 30 Gen, 10:16, "Gabriel Genellina" wrote: En Fri, 30 Jan 2009 05:43:33 -0200, Mabooka-Mabooka Mbe-Mbe   escribió: >   setsockopt(REUSEADDR)... s.allow_reuse_address=1 > should do the trick. It's too late then; bind()

Re: Noob question

2009-01-30 Thread Bruno Desthuilliers
nanoe...@gmail.com a écrit : Hello? Hi. Ok, first, this is mostly OT here - your question should have gone to either the project's maintainer or any Ubuntu forum / mailing-list/whatever. I'm currently installed Ubuntu 8.10. I'm not a Linux person, so I don't know a lot about it. The rea

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-30 Thread Reckoner
On Jan 28, 9:49 am, koranthala wrote: > On Jan 28, 10:39 pm,Reckoner wrote: > > > > > On Jan 28, 9:16 am, koranthala wrote: > > > > On Jan 28, 5:42 pm, koranthala wrote: > > > > > On Jan 28, 2:16 am,Reckoner wrote: > > > > > > I'm not sure this is possible, but I would like to have > > > > > a l

Re: is python Object oriented??

2009-01-30 Thread Tim Rowe
2009/1/30 Hung Vo : > I want to justify the above question (is Python Object-Oriented?). > Does Python follow the concepts/practices of Encapsulation, > Polymorphism and Interface, which are quite familiar to Java > programmers? It's not the role of the language to follow those concepts, it's the

Re: py2exe + SQLite problem

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 09:50:08 -0200, Armin escribió: Gabriel Genellina wrote: En Thu, 29 Jan 2009 13:05:11 -0200, Armin escribió: Did you solve this problem? As you posted 4 related messages and the last one might imply a solution to this first one... Yes, the distutil option 'data_files'

Re: New to python, open source Mac OS X IDE?

2009-01-30 Thread Wolfgang Keller
> I'm on a Mac. I use Netbeans for Java, PHP, and C if needed. Do you > even use an IDE for Python? WingIDE Not open source, but by far the best that I've tried. Sincerely, Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Address already in use' ... with TCPServer

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 10:44:22 -0200, Gabriel Genellina escribió: Sorry the duplicate post! I've seen that some of my messages come twice. I'll try to diagnose and fix the problem (if possible...). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding to the nearest 5

2009-01-30 Thread Gary Herron
todp...@hotmail.com wrote: > How can you make python round numbers to the nearest 5: > > Example: > > 3 => 0 > 8 => 10 > 23.2 => 20 > 36 => 35 > 51.5 => 50 round(n,-1) rounds to the nearest 10, so round(n*2,-1)/2 will round to the nearest five. Gary Herron > > > Thanks! > > -

Adding a positive number and a negative number

2009-01-30 Thread Eric Kang
In two’s complement representation, can adding one positive and one negative give you overflow? -- http://mail.python.org/mailman/listinfo/python-list

search speed

2009-01-30 Thread anders
Hi! I have written a Python program that serach for specifik customer in files (around 1000 files) the trigger is LF01 + CUSTOMERNO So a read all fils with dirchached Then a loop thru all files each files is read with readLines() and after that scaned Today this works fine, it saves me a lot of

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Jeff McNeil
On Jan 30, 7:33 am, Chris Rebert wrote: > On Fri, Jan 30, 2009 at 4:27 AM, Hongyi Zhao wrote: > > Hi all, > > > Suppose I've the entries like the following in my file: > > > -- > > 116.52.155.237:80 > > ip-72-55-191-6.static.privatedns.com:3128 > > 222.124.135.40:80 > > 217.151.23

Re: search speed

2009-01-30 Thread Justin Wyer
On Fri, Jan 30, 2009 at 1:51 AM, anders wrote: > Hi! > I have written a Python program that serach for specifik customer in > files (around 1000 files) > the trigger is LF01 + CUSTOMERNO > > So a read all fils with dirchached > > Then a loop thru all files each files is read with readLines() and

Re: Adding a positive number and a negative number

2009-01-30 Thread MRAB
Eric Kang wrote: In two’s complement representation, can adding one positive and one negative give you overflow? > No. -- http://mail.python.org/mailman/listinfo/python-list

Re: search speed

2009-01-30 Thread D'Arcy J.M. Cain
On Fri, 30 Jan 2009 15:46:33 +0200 Justin Wyer wrote: > $ find -name "*" -exec grep -nH "LF01" {} \; > | cut -d ":" -f 1 | sort | uniq I know this isn't a Unix group but please allow me to suggest instead; $ grep -lR LF01 -- D'Arcy J.M. Cain | Democracy is three wolves http://www

Re: Rounding to the nearest 5

2009-01-30 Thread D'Arcy J.M. Cain
On 30 Jan 2009 06:23:17 GMT Steven D'Aprano wrote: > On Fri, 30 Jan 2009 00:24:47 -0500, D'Arcy J.M. Cain wrote: > > That appears to be rounding to nearest 10, not 5. Clarify your > > requirements first. > > Look again. 36 => 35. You are correct. I should have ommitted my first sentence and em

Re: search speed

2009-01-30 Thread Tim Rowe
2009/1/30 Diez B. Roggisch : > No. Because nobody can automagically infer whatever structure your files > have. Just so. But even without going to a full database solution it might be possible to make use of the flat file structure. For example, does the "LF01" have to appear at a specific positi

Re: is python Object oriented??

2009-01-30 Thread Veerendra Ganiger
Python is not purely object oriented programming, because we can write functions without any class. You are right, predefined class attributes are available when we write or execute a piece of python code without defining class, that means it's just using objects for it's purpose. It does not mean

Re: Swapping values of two variables

2009-01-30 Thread MRAB
Grant Edwards wrote: > On 2009-01-30, MRAB wrote: > >>> What is the minimum amount of extra memory required to exchange two >>> 32-bit quantities? What would be the pseudocode that achieves this >>> minimum? >> x ^= y >> y ^= x >> x ^= y >> >> This is really only of use when working in assembly l

Re: Adding a positive number and a negative number

2009-01-30 Thread Grant Edwards
On 2009-01-30, MRAB wrote: > Eric Kang wrote: > >> In two's complement representation, can adding one positive >> and one negative give you overflow? >> > No. AFAIK, in Python adding integers never gives you overlow regardless of sign. -- Grant Edwards grante Yow!

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
On Fri, 30 Jan 2009 05:41:29 -0800 (PST), Jeff McNeil wrote: [snipped] >Why not just use socket.gethostbyname? > >Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) >[GCC 4.3.2] on linux2 >Type "help", "copyright", "credits" or "license" for more information. import socket socket.gethostby

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
On Fri, 30 Jan 2009 22:48:00 +0800, Hongyi Zhao wrote: >On Fri, 30 Jan 2009 05:41:29 -0800 (PST), Jeff McNeil > wrote: >[snipped] >>Why not just use socket.gethostbyname? >> >>Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) >>[GCC 4.3.2] on linux2 >>Type "help", "copyright", "credits" or "licens

Re: Get thread pid

2009-01-30 Thread Alejandro
On Jan 30, 4:00 am, Ove Svensson wrote: > Pidis a process identifier. Threads are not processes. All your threads > execute within the context if a single process, hence they should have > the samepid. Threads may have athreadid but it is not the same as thepid. According to this document (http:/

Re: is python Object oriented??

2009-01-30 Thread Grant Edwards
On 2009-01-30, Chris Rebert wrote: > On Thu, Jan 29, 2009 at 9:56 PM, Hung Vo wrote: > >> I'm new to Python and also wondering about OOP in Python. >> >> I want to justify the above question (is Python Object-Oriented?). >> Does Python follow the concepts/practices of Encapsulation, >> Polymorphi

Hello..General question about TKinter.

2009-01-30 Thread Rupp Peter - prupp
Hello, I am a fluent Python programmer, but have limited (zero) GUI experience. I need to write simple GUI's fairly quickly and would prefer to use TKinter for it's simplicity and longevity. (I tried to compile QT on both HPUX and Solaris with recent compilers...and compiles/builds failed.

Re: Using equals operator without changing reference pointer

2009-01-30 Thread mark . seagoe
On Jan 29, 8:03 pm, Terry Reedy wrote: > Erik Max Francis wrote: > > mark.sea...@gmail.com wrote: > > >> Is there a way to lock down myInst so that it still refers to the > >> original object, and is there some special member that will allow me > >> to override the equals operator in this case?  O

Re: Swapping values of two variables

2009-01-30 Thread Christian Heimes
Steven D'Aprano schrieb: > Ints in Python are *objects*, not 32-bit quantities. An int is 12 bytes > (96 bits) in size; a long will use as much memory as needed. If your > application needs to optimize a swap of two ints, then Python is probably > going to be much too memory-intensive for you.

Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Linuxguy123
I'm trying to build a small Python app in Eclipse under Fedora 10. I have the following code: import os import sys import pexpect child = pexpect.spawn('/bin/bash') child.interact() When I run it in Eclipse, I get: Traceback (most recent call last): File "/home/xxx/workspace/FixPermissions/s

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 06:56:10 -0800 (PST), Alejandro wrote: On Jan 30, 4:00 am, Ove Svensson wrote: Pidis a process identifier. Threads are not processes. All your threads execute within the context if a single process, hence they should have the samepid. Threads may have athreadid but it is n

Re: Get thread pid

2009-01-30 Thread ma
Actually, the command given "ps axH" uses H which shows threads as if they were processes. If you check the pid of these "processes," you would find that they are all equivalent. On Fri, Jan 30, 2009 at 9:56 AM, Alejandro wrote: > On Jan 30, 4:00 am, Ove Svensson wrote: > > Pidis a process iden

relpath problem on windows

2009-01-30 Thread eliben
I'm having a problem with 2.6's new os.path.relpath function. This is correct: relpath(r'd:\abc\jho', r'd:\abc') => 'jho' But this isn't: relpath(r'd:\jho', r'd:\\') => '..\jho' Neither is this: relpath(r'd:\jho', r'd:') => '..\..\..\jho' What am I missing? -- http://mail.python.org/mailman

Re: Get thread pid

2009-01-30 Thread Alejandro
On Jan 30, 9:11 am, Jean-Paul Calderone wrote: > [clarification about threads] Thank you for the clarification. I will reformulate my question: pstree and also ntop (but not top) show a number for each thread, like for instance: $pstree -p 9197 python(9197)€ˆ€{python}(9555) †€{pyth

Re: Sloooooowwwww WSGI restart

2009-01-30 Thread Ron Garret
In article <146f6796-37b5-4220-bdb1-5119cb3ac...@z6g2000pre.googlegroups.com>, Graham Dumpleton wrote: > On Jan 30, 9:53 am, Ron Garret wrote: > > In article <498171a5$0$3681$426a7...@news.free.fr>, > >  Bruno Desthuilliers > > > >  wrote: > > > Ron Garret a écrit : > > > > In article , > > >

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-30 Thread Ron Garret
In article <63cf7deb-f15c-4259-aa24-1b8da8468...@r41g2000prr.googlegroups.com>, Graham Dumpleton wrote: > On Jan 30, 11:01 am, Ron Garret wrote: > > In article , > >  Joshua Kugler wrote: > > > > > Ron Garret wrote: > > > > My question is: is this supposed to be happening?  Or is this an > >

Re: Get thread pid

2009-01-30 Thread ma
I think issue here is that you're invoking a system call (using either the subprocess module or os.popen*) from your threads. Those *are* external processes and will show up under pstree since they have a parent process. If you're using subprocess.Popen() the object that is returned has an attribut

Announcing Pyflakes 0.3.0

2009-01-30 Thread Jean-Paul Calderone
I am proud to announce the release of Pyflakes 0.3.0. This release fixes several bugs, improves compatibility with recent versions of Python, and new flake checks. Pyflakes is a static analysis tool for Python source. It is focused on identifying common errors quickly without executing Python c

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread Stephen Hansen
On Fri, Jan 30, 2009 at 12:38 AM, r wrote: > On Jan 30, 2:26 am, John Machin wrote: > [snip] > > This doesn't appear to match the description. Perhaps the PSU has > > subverted my comp)(*&^...@! > > NO CARRIER > > Oops -- Good catch John, > Even perfect people like myself make mistakes :). Here

Re: search speed

2009-01-30 Thread Scott David Daniels
Tim Rowe wrote: But even without going to a full database solution it might be possible to make use of the flat file structure. For example, does the "LF01" have to appear at a specific position in the input line? If so, there's no need to search for it in the complete line. *If* there is an

Re: Swapping values of two variables

2009-01-30 Thread Grant Edwards
> Grant Edwards wrote: > > On 2009-01-30, MRAB wrote: > > > >>> What is the minimum amount of extra memory required to exchange two > >>> 32-bit quantities? What would be the pseudocode that achieves this > >>> minimum? > >> x ^= y > >> y ^= x > >> x ^= y > >> > >> This is really only of use when

Re: Adding a positive number and a negative number

2009-01-30 Thread Scott David Daniels
Grant Edwards wrote: On 2009-01-30, MRAB wrote: Eric Kang wrote: In two's complement representation, can adding one positive and one negative give you overflow? No. AFAIK, in Python adding integers never gives you overlow regardless of sign. Right, but he wants his homework answer. -- http

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 08:33:53 -0800 (PST), Alejandro wrote: On Jan 30, 9:11 am, Jean-Paul Calderone wrote: [clarification about threads] Thank you for the clarification. I will reformulate my question: pstree and also ntop (but not top) show a number for each thread, like for instance: $ps

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread MRAB
Stephen Hansen wrote: On Fri, Jan 30, 2009 at 12:38 AM, r > wrote: On Jan 30, 2:26 am, John Machin mailto:sjmac...@lexicon.net>> wrote: [snip] > This doesn't appear to match the description. Perhaps the PSU has > subverted my comp)(*&^...@! > NO CA

What's new in 3.0 about threading?

2009-01-30 Thread 郑义
Hello I have questions about threading: import threading class myThread(threading.Thread): def run(self): print('hello,threads') if __name__=='__main__': threads=myThread() threads.start() Above program does't work at 'Run Module' in IDLE,but it works well under executing scri

Re: Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Gary Duzan
On Jan 30, 11:03 am, Linuxguy123 wrote: > I'm trying to build a small Python app in Eclipse under Fedora 10. > > I have the following code: > > import os > import sys > import pexpect > > child = pexpect.spawn('/bin/bash') > child.interact() > > When I run it in Eclipse, I get: > > Traceback (most

Python Developer needed for Greenwich, CT assignment

2009-01-30 Thread ronaldjweiss
Senior Python Programmer needed to develop, enhance and expand a Trade Capture application at a hedge fund client. The technical platform includes MySQL running both on Windows and UNIX. Requirements: 3-6+ years solid Python development skills and experience in the brokerage industry a must. SQL

Odd syntactic NON-error?

2009-01-30 Thread Alaric Haag
Hello, I just noticed that I've been successfully importing a module I wrote which contains a class definition that begins with (docstring removed): class TDF(): def __init__(self, name='', mode=tscan. GP_NOCLOBBER): Note the "space" which shouldn't be here---^ I'm running Python 2.5.2.

Re: Odd syntactic NON-error?

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 11:36:45 -0600, Alaric Haag wrote: Hello, I just noticed that I've been successfully importing a module I wrote which contains a class definition that begins with (docstring removed): class TDF(): def __init__(self, name='', mode=tscan. GP_NOCLOBBER): Note the "space" w

RE: Rounding to the nearest 5

2009-01-30 Thread Benjamin J. Racine
Doesn't this work? round_by_5.py >>> import sys def round_by_5(x= sys.argv[0]): x = x/5. x = round(x) x = x*5 print(x) return x Ben R. -Original Message- From: python-list-bounces+bjracine=glosten@python.org [mailto:python-list-bounces+bj

A replacement to closures in python?

2009-01-30 Thread Noam Aigerman
Hi, I want to create an array of functions, each doing the same thing with a change to the parameters it uses... something like: arr=['john','terry','graham'] funcs=[] for name in arr: def func(): print 'hello, my name is '+name

Re: error on building 2.6.1. (_ctypes)

2009-01-30 Thread Bernard Rankin
> > > I am trying to build python 2.6 on a machine (web server) that I do not > > have > root access to. (has 2.4 installed) > > > > Python 2.5 builds fine, but I am getting an error when I run "make" for > > 2.6.1. > > > > > > /home/username/local-src/

Re: Importing modules

2009-01-30 Thread Aahz
In article <631e2879-6171-417e-8254-7f78c8cfc...@i24g2000prf.googlegroups.com>, alex23 wrote: > >If you're having to set up your imports in a specific order, odds are >you have either a circular dependency or are overusing 'from >import *'. You should -never- (IMO) do something like 'from librar

Re: A replacement to closures in python?

2009-01-30 Thread Stephen Hansen
On Fri, Jan 30, 2009 at 10:36 AM, Noam Aigerman wrote: Hi, I want to create an array of functions, each doing the same thing with a change to the parameters it uses… something like:I'm not really sure what you're trying to accomplish so there may be a better answer, bu

Re: Function Application is not Currying

2009-01-30 Thread Jon Harrop
I had hoped someone else would correct you but they haven't. So... Xah Lee wrote: > Here are some examples of a function that returns a function as > result, but is not currying. > > Mathematica example: > > f[n_]:=Function[n^#]; > f[7][2] > (* returns 49 *) > > Emacs lisp example: > > (defma

Re: Function Application is not Currying

2009-01-30 Thread Tim Greer
Jon Harrop wrote: > I had hoped someone else would correct you but they haven't. So... The lack of replies aren't about anyone correcting him or not, it's that the guy just posts anything he can to spamvertize his site and tell everyone how brilliant he thinks he is. It's just a method he uses t

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread Ivan Illarionov
r wrote: > Where are the community projects supporting Python? -- besides the > core devlopment. Seem s that nobody is interested unless their pay-pal > account is involved. I find this all quite disappointing. Hi r, Can you just type import antigravity and join us up there? Hatred for Ruby

Re: is python Object oriented??

2009-01-30 Thread Michael Torrie
Hung Vo wrote: > I'm new to Python and also wondering about OOP in Python. > > I want to justify the above question (is Python Object-Oriented?). > Does Python follow the concepts/practices of Encapsulation, > Polymorphism and Interface, which are quite familiar to Java > programmers? I'd say tha

Re: search speed

2009-01-30 Thread John Machin
D'Arcy J.M. Cain druid.net> writes: > > On Fri, 30 Jan 2009 15:46:33 +0200 > Justin Wyer gmail.com> wrote: > > $ find -name "*" -exec grep -nH "LF01" {} \; > > | cut -d ":" -f 1 | sort | uniq > > I know this isn't a Unix group but please allow me to suggest instead; > > $ grep -lR LF01

Re: is python Object oriented??

2009-01-30 Thread Michael Torrie
Veerendra Ganiger wrote: > Python is not purely object oriented programming, because we can write > functions without any class. > You are right, predefined class attributes are available when we write or > execute a piece of python code without defining class, that means it's just > using objects

Re: Get thread pid

2009-01-30 Thread Christian Heimes
Alejandro schrieb: > Hi: > > I have Python program running under Linux, that create several > threads, and I want to now the corresponding PID of the threads. May I ask why you want to get the TID? You can't do anything useful with it. You can't kill a thread safely, neither from within Python no

Re: Odd syntactic NON-error?

2009-01-30 Thread Alaric Haag
In article <20090130173948.12853.732928641.divmod.quotient@henry.divmod.com>, Jean-Paul Calderone wrote: > On Fri, 30 Jan 2009 11:36:45 -0600, Alaric Haag wrote: > >Hello, > > > >I just noticed that I've been successfully importing a module I wrote > >which contains a class definition that

Re: search speed

2009-01-30 Thread Stefan Behnel
D'Arcy J.M. Cain wrote: > On Fri, 30 Jan 2009 15:46:33 +0200 > Justin Wyer wrote: >> $ find -name "*" -exec grep -nH "LF01" {} \; >> | cut -d ":" -f 1 | sort | uniq > > I know this isn't a Unix group but please allow me to suggest instead; > > $ grep -lR LF01 That's a very good advice. I ha

Re: writing large dictionaries to file using cPickle

2009-01-30 Thread perfreem
On Jan 28, 6:08 pm, Aaron Brady wrote: > On Jan 28, 4:43 pm, perfr...@gmail.com wrote: > > > On Jan 28, 5:14 pm, John Machin wrote: > > > > On Jan 29, 3:13 am, perfr...@gmail.com wrote: > > > > > hello all, > > > > > i have a large dictionary which contains about 10 keys, each key has a > > > > v

Re: Rounding to the nearest 5

2009-01-30 Thread David
Benjamin J. Racine wrote: Doesn't this work? round_by_5.py import sys def round_by_5(x= sys.argv[0]): x = x/5. x = round(x) x = x*5 print(x) return x Ben R. I am learning, I got this to work fine; #!/usr/bin/python import sys def round_by_5(x = sys.argv[1]): x =

Re: is python Object oriented??

2009-01-30 Thread Christian Heimes
Michael Torrie schrieb: >> It all depends on implementation, I think even we can make "C" object >> oriented with proper implementation. > > Indeed, any code based on gobject libraries can be object-oriented in > design and function. The Python C API is a good example for well designed and object

Re: search speed

2009-01-30 Thread Stefan Behnel
Diez B. Roggisch wrote: > that's not necessarily the best thing to do if things have a > record-like structure. The canonical answer to this is then to use a > database to hold the data, instead of flat files. So if you have any > chance to do that, you should try & stuff things in there. It's wor

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-30 Thread Stef Mientki
Marc 'BlackJack' Rintsch wrote: On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: try this: class MyRegClass ( int ) : def __init__ ( self, value ) : self.Value = value def __repr__ ( self ) : line = hex ( self.Value ) line = line [:2] + line [2:].upper() return li

python is a python

2009-01-30 Thread x
python is a python -- http://mail.python.org/mailman/listinfo/python-list

Re: Odd syntactic NON-error?

2009-01-30 Thread Simon Brunning
2009/1/30 Alaric Haag : > So, is the "secret" that the period is syntactically an "operator" like > + or * ? Exactly that: . Sh! -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Re: relpath problem on windows

2009-01-30 Thread Scott David Daniels
eliben wrote: I'm having a problem with 2.6's new os.path.relpath function. > ... But this isn't [correct]: relpath(r'd:\jho', r'd:\\') => '..\jho' Neither is this: relpath(r'd:\jho', r'd:') => '..\..\..\jho' What am I missing? There is no way to write a raw string for text ending in a singl

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread Terry Reedy
Stephen Hansen wrote: On Fri, Jan 30, 2009 at 12:38 AM, r Personally, I work for a division in our company that has converted over the last few years our entire software line from an old, Windows-only mix of C and VCL-stuff, to a serious mid-sized product which recently clocked in at about 16

Re: What's new in 3.0 about threading?

2009-01-30 Thread Terry Reedy
郑义 wrote: Hello I have questions about threading: import threading class myThread(threading.Thread): def run(self): print('hello,threads') if __name__=='__main__': threads=myThread() threads.start() Above program does't work at 'Run Module' in IDLE, What does 'doesn't work

accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
i am trying to access elements of a tuple without using the [1:5] notation. the contents of the tuple are as follows: ('--datasourcename', 'DB') I want to access everything in the second argument, but i am not sure how to go about this without converting to a string. thanks in advance -- http://m

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
let me re-phrase that question: i would like to access the element of individual tuples inside of a list, by using an index. so i have the list contents print list [('--datasourcename', 'DB'), ('--password', '123')] How can I access "DB" from the list directly using an index? right now I would h

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-30 Thread Robert Kern
On 2009-01-29 18:22, Reckoner wrote: I haven't looked at Enthought in awhile. I want to avoid having to installing the entire Enthought toolsuite, however. Would I have to do that for Traits? No, Traits can be installed by itself unless if you want its GUI capabilities. http://pypi.python

Re: accessing elements of a tuple

2009-01-30 Thread D'Arcy J.M. Cain
On Fri, 30 Jan 2009 14:23:31 -0800 Matthew Sacks wrote: > let me re-phrase that question: > i would like to access the element of individual tuples inside of a > list, by using an index. > so i have the list contents > > print list > [('--datasourcename', 'DB'), ('--password', '123')] > > How ca

Re: accessing elements of a tuple

2009-01-30 Thread Ian Pilcher
Matthew Sacks wrote: > How can I access "DB" from the list directly using an index? list[0][1] ... or did I misunderstand your question? -- Ian Pilcher arequip...@gmail.com =

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread Steve Holden
Ivan Illarionov wrote: > r wrote: >> Where are the community projects supporting Python? -- besides the >> core devlopment. Seem s that nobody is interested unless their pay-pal >> account is involved. I find this all quite disappointing. > > Hi r, > > Can you just type > >import antigravity

Re: accessing elements of a tuple

2009-01-30 Thread Tim Chase
let me re-phrase that question: i would like to access the element of individual tuples inside of a list, by using an index. so i have the list contents print list [('--datasourcename', 'DB'), ('--password', '123')] How can I access "DB" from the list directly using an index? right now I would

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
>First of all, list is a reserved word. Don't use it as a variable name. I was using it as an example in this case. >mylist[0][1] if I understand the question. This works. Thank you. On Fri, Jan 30, 2009 at 2:39 PM, Tim Chase wrote: >> let me re-phrase that question: >> i would like to access t

Re: search speed

2009-01-30 Thread Jervis Whitley
> > > Today this works fine, it saves me a lot of manuall work, but a seach > takes around 5 min, > so my questin is is there another way of search in a file > (Today i step line for line and check) > If the files you are searching are located at some other location on a network, you may find that

problem with program - debugging leading nowhere

2009-01-30 Thread Matthew Sacks
i am trying to figure out what has gone wrong in my python program. it is complaining that there is an indendation error. should be simple enough but im stuck on this one. if anyone can help unjolt me it would be appreciated. thank you error message: Traceback (most recent call last): File ""

  1   2   >