Re: import reassignment different at module and function scope

2009-01-30 Thread Chris Rebert
On Fri, Jan 30, 2009 at 11:31 PM, Brendan Miller wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > If I: > > import sys > > sys = sys.version > > This executes find but: > > import sys > > def f(): >sys = sys.version > > This gives an error indicating that the sys on the right hand

Re: Number of bits/sizeof int

2009-01-30 Thread Jon Clements
On Jan 31, 7:29 am, John Machin wrote: > On Jan 31, 6:03 pm, Jon Clements wrote: > > > Hi Group, > > > This has a certain amount of irony (as this is what I'm pretty much > > after):- > > Fromhttp://docs.python.org/dev/3.0/whatsnew/3.1.html: > > "The int() type gained a bit_length method that ret

Re: Number of bits/sizeof int

2009-01-30 Thread Gabriel Genellina
En Sat, 31 Jan 2009 05:03:27 -0200, Jon Clements escribió: This has a certain amount of irony (as this is what I'm pretty much after):- From http://docs.python.org/dev/3.0/whatsnew/3.1.html: "The int() type gained a bit_length method that returns the number of bits necessary to represent it

Re: Number of bits/sizeof int

2009-01-30 Thread Scott David Daniels
Jon Clements wrote: ... From http://docs.python.org/dev/3.0/whatsnew/3.1.html: "The int() type gained a bit_length method that returns the number of bits necessary to represent its argument in binary:" Any tips on how to get this in 2.5.2 as that's the production version I'm stuck with. Well,

import reassignment different at module and function scope

2009-01-30 Thread Brendan Miller
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If I: import sys sys = sys.version This executes find but: import sys def f(): sys = sys.version This gives an error indicating that the sys on the right hand side of = is undefined. What gives? -BEGIN PGP SIGNATURE- Version: GnuPG v1

Re: Number of bits/sizeof int

2009-01-30 Thread John Machin
On Jan 31, 6:03 pm, Jon Clements wrote: > Hi Group, > > This has a certain amount of irony (as this is what I'm pretty much > after):- > Fromhttp://docs.python.org/dev/3.0/whatsnew/3.1.html: > "The int() type gained a bit_length method that returns the number of > bits necessary to represent its a

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

2009-01-30 Thread Hendrik van Rooyen
"Gabriel Genellina" wrote: >Consider this expression: g = (x+A for x in L for y in M). This is >currently expanded more or less like this: > >def foo(L): > for x in L: > for y in M: > yield x+A >g = foo(iter(L)) > >(as your example above) Note that L has a special status -- it's t

Number of bits/sizeof int

2009-01-30 Thread Jon Clements
Hi Group, This has a certain amount of irony (as this is what I'm pretty much after):- >From http://docs.python.org/dev/3.0/whatsnew/3.1.html: "The int() type gained a bit_length method that returns the number of bits necessary to represent its argument in binary:" Any tips on how to get this in

Re: error on building 2.6.1. (_ctypes)

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 16:52:07 -0200, Bernard Rankin escribió: > 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. Mmm... my 2.6.1 source show

Re: relpath problem on windows

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 14:30:53 -0200, eliben escribió: 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' Looks like a real bug to me -- please submit it to http://b

Re: error C3861: 'Py_InitModule'

2009-01-30 Thread duprez
Ok, I found the reason, you now need to do a bit more work and use PyModule_Create(). Also, for anyone else that may stumble on this, you need to refer to the online Dev doc's that get updated regularly (which I regrettably forgot about) which are here -> http://docs.python.org/dev/3.0/ thanks, M

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

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 12:53:33 -0200, Hongyi Zhao escribió: See the following errors I in my case: $ python 'import site' failed; use -v for traceback import socket Traceback (most recent call last): File "", line 1, in ImportError: No module named socket Those errors indicate that Pyt

Re: ImportError in embedded Python Interpreter

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 08:50:45 -0200, escribió: 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? Why so? Are you in an embedded environment or something that doesn't have a filesys

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

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 06:42:22 -0200, Peter Otten <__pete...@web.de> escribió: Gabriel Genellina wrote: g = (x+B for x in A) I think it helps understanding if you translate the above to A = [1,2,3] B = 1 def f(a): ... for x in a: ... yield x+B ... g = f(A) A = [4,5,6] B =

RE: nth root

2009-01-30 Thread Tim Roberts
Dan, Thanks - you're probably right - just my intuition said to me that rather than calculating that the 13th root of 4021503534212915433093809093996098953996019232 is 3221.2904208350265 there must be a quicker way of finding out its between 3221 and 3222 but perhaps not. Tim __

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

2009-01-30 Thread Gabriel Genellina
En Fri, 30 Jan 2009 07:08:29 -0200, Hendrik van Rooyen escribió: "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 o

Re: Mathematica 7 compares to other languages

2009-01-30 Thread William James
w_a_x_...@yahoo.com wrote: > On Dec 25, 5:24 am, Xah Lee wrote: > > > The JavaScript example: > > > > // Javascript. By William James > > function normalize( vec ) { > > var div=Math.sqrt(vec.map(function(x) x*x).reduce(function(a,b) > > a+b))   return vec.map(function(x) x/div) > > > > } > >

error C3861: 'Py_InitModule'

2009-01-30 Thread duprez
Hi All, Using python 3.0, VS2005, WinXP SP3 I know this looks like a simple one but i just installed Python 3.0 (no other Python installations etc) and I'm trying to convert my perfectly working 2.5 C code for an embedded interpreter to 3.0. I've changed all of my string functions etc to remove th

Re: Securing a database

2009-01-30 Thread Aahz
In article , wrote: > >My company provides some services online, which now they are planning >to make it offline and sell to customers who can use it in their >networks. How critical is it that this application work completely offline? I suggest that you seriously consider making your applicati

Re: nth root

2009-01-30 Thread Dan Goodman
Takes less than 1 sec here to do (10**100)**(1./13) a million times, and only about half as long to do (1e100)**(1./13), or about 14 times as long as to do .2**2. Doesn't look like one could hope for it to be that much quicker as you need 9 sig figs of accuracy to get the integer part of (10**1

FINAL REMINDER: OSCON 2009: Call For Participation

2009-01-30 Thread Aahz
The O'Reilly Open Source Convention has opened up the Call For Participation -- deadline for proposals is Tuesday Feb 3. OSCON will be held July 20-24 in San Jose, California. For more information, see http://conferences.oreilly.com/oscon http://en.oreilly.com/oscon2009/public/cfp/57 -- Aahz (a.

Re: search speed

2009-01-30 Thread rdmurray
Quoth Tim Chase : > PS: as an aside, how do I import just the fnmatch function? I > tried both of the following and neither worked: > >from glob.fnmatch import fnmatch >from glob import fnmatch.fnmatch > > I finally resorted to the contortion coded below in favor of >import glob >

RE: nth root

2009-01-30 Thread Tim Roberts
Unfortunately, unless I'm doing something wrong, this appears to take 20 times as long... :-) What on earth are numpy and psyco? Do I need to watch the Lord of the Rings? Tim Tim wrote: > In PythonWin I'm running a program to find the 13th root (say) of > millions of hundred-digit numbers

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-30 Thread rdmurray
Quoth Ron Garret : > In article , > Joshua Kugler wrote: > > > Ron Garret wrote: > > > My question is: is this supposed to be happening? Or is this an > > > indication that something is wrong, and if so, what? > > > > You are probably just hitting a different instance of Apache, thus the > > d

SimpleXMLRPCServer question

2009-01-30 Thread rdmurray
Quoth flagg : > I am working on a very basic xmlrpc server, which will expose certain > functions for administering BIND zone files. The big problem I am > having is parsing the incoming xmlrpc request. Basically part of the > xmlrpc request will help deterime which zone file is edited.I have

Re: search speed

2009-01-30 Thread Tim Chase
I have written a Python program that serach for specifik customer in files (around 1000 files) the trigger is LF01 + CUSTOMERNO While most of the solutions folks have offered involve scanning all the files each time you search, if the content of those files doesn't change much, you can build a

Re: Importing modules

2009-01-30 Thread rdmurray
Quoth Mudcat : > [attribution omitted by Mudcat] > > I think you've probably had issues with circular imports (i.e. mutual > > dependencies), unless you can precisely remember what you were doing and > > what went wrong. > > That's possible, but circular imports become more of a hazard if you > hav

Re: nth root

2009-01-30 Thread MRAB
Tim wrote: In PythonWin I'm running a program to find the 13th root (say) of millions of hundred-digit numbers. I'm using n = 13 root = base**(1.0/n) which correctly computes the root to a large number of decimal places, but therefore takes a long time. All I need is the integer comp

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

2009-01-30 Thread rdmurray
Quoth 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 ( se

SimpleXMLRPCServer question

2009-01-30 Thread flagg
I am working on a very basic xmlrpc server, which will expose certain functions for administering BIND zone files. The big problem I am having is parsing the incoming xmlrpc request. Basically part of the xmlrpc request will help deterime which zone file is edited.I have been looking at the d

nth root

2009-01-30 Thread Tim
In PythonWin I'm running a program to find the 13th root (say) of millions of hundred-digit numbers. I'm using n = 13 root = base**(1.0/n) which correctly computes the root to a large number of decimal places, but therefore takes a long time. All I need is the integer component. Is there

Re: Adding a positive number and a negative number

2009-01-30 Thread John Machin
On Jan 31, 4:10 am, Scott David Daniels wrote: > 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 over

Re: Swapping values of two variables

2009-01-30 Thread Grant Edwards
On 2009-01-31, Aahz wrote: >>But could the swapping be done using less extra memory than this? What >>is the minimum amount of extra memory required to exchange two 32-bit >>quantities? What would be the pseudocode that achieves this minimum? > > This looks like a homework problem to me It l

Re: is python Object oriented??

2009-01-30 Thread Hung Vo
On Fri, Jan 30, 2009 at 5:15 PM, 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 Enca

Re: naming and binding (subtle Python 3 change)

2009-01-30 Thread Alan G Isaac
On 1/29/2009 10:50 PM Terry Reedy apparently wrote: http://bugs.python.org/issue5106 Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: writing large dictionaries to file using cPickle

2009-01-30 Thread Aaron Brady
On Jan 30, 2:44 pm, perfr...@gmail.com wrote: > 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 d

Re: Adding a positive number and a negative number

2009-01-30 Thread Steve Holden
Scott David Daniels wrote: > 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.

Re: problem with program - debugging leading nowhere

2009-01-30 Thread Matthew Sacks
this works. thanks! On Fri, Jan 30, 2009 at 3:59 PM, Jervis Whitley wrote: > > >> >> >> >> >> error message: >> Traceback (most recent call last): >> File "", line 1, in >> IndentationError: expected an indented block (, line 39) >> >> code: >> http://pastebin.com/f2f971f91 > > Hi, > > It looks

Re: problem with program - debugging leading nowhere

2009-01-30 Thread Ben Finney
Matthew Sacks writes: > 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. Step one: Ensure the problem doesn't get

Re: accessing elements of a tuple

2009-01-30 Thread John Machin
On Jan 31, 9:42 am, Matthew Sacks wrote: > >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:

Re: problem with program - debugging leading nowhere

2009-01-30 Thread John Machin
On Jan 31, 10:43 am, Matthew Sacks wrote: > 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 > > erro

Re: Swapping values of two variables

2009-01-30 Thread Aahz
In article , Eric Kang wrote: > >In python, I set: > >x=1 >y=3 > >z = x >x = y >y = z > > >This gave me 3 1, which are the values of x and y swapped. >The following would have given me the same result: >x, y = y, x > > > >But could the swapping be done using less extra memory than this? What >is

Re: Function Application is not Currying

2009-01-30 Thread J�rgen Exner
Jon Harrop wrote: >I had hoped someone else would correct you but they haven't. So... That is because ... >Xah Lee wrote: ... everyone with more than 5 cents of brain has killfiled him a long time ago. jue -- http://mail.python.org/mailman/listinfo/python-list

problem with program - debugging leading nowhere

2009-01-30 Thread Jervis Whitley
-- Forwarded message -- From: Jervis Whitley Date: Sat, Jan 31, 2009 at 10:59 AM Subject: Re: problem with program - debugging leading nowhere To: Matthew Sacks Cc: python-list@python.org > > > > error message: > Traceback (most recent call last): > File "", line 1, in > In

Re: problem with program - debugging leading nowhere

2009-01-30 Thread Jervis Whitley
> > > > error message: > Traceback (most recent call last): > File "", line 1, in > IndentationError: expected an indented block (, line 39) > > code: > http://pastebin.com/f2f971f91 > Hi, It looks like you have commented out a line on line 30, you need to place something in here, as python is

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 ""

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

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: 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: 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 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: 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: 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 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

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: 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

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: 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: 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

python is a python

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

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

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: 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: 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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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: 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: 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: 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/

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: 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

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

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.

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

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

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: 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

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: 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: 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: 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: 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

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: 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

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: 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: 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

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 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

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

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: 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.

  1   2   >