Re: Function Overloading and Python

2008-02-25 Thread Stefan Behnel
Allen Peloquin wrote: > On Feb 24, 11:44 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Allen Peloquin wrote: >>> class B >>> { >>> fun(A x, A y, A z)... >>> fun(A1 x, A y, A z)... >>> } >>> class B1 >>> { >>> fun(A1 x, A y, A z)... >>> } >>> Such that any previous behavior is inherite

Re: PHP Developer highly interested in Python (web development) with some open questions...

2008-02-25 Thread Bruno Desthuilliers
Diez B. Roggisch a écrit : >> >> It's also some kind of a Rube Goldberg thingie... >> http://en.wikipedia.org/wiki/Rube_Goldberg_machine >> >> If you're into web applications, better to have a look at Pylons or >> Django IMHO. > > You are entitled to your opinion, but calling Zope a > Rube-Goldbe

network programming: how does s.accept() work?

2008-02-25 Thread 7stud
I have the following two identical clients #test1.py:--- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052 #server port s.connect((host, port)) print s.getsockname() response = [] while 1: piece = s.recv(1024) if piece == '':

Re: Function Overloading and Python

2008-02-25 Thread Bruno Desthuilliers
Allen Peloquin a écrit : > I have a personal project that has an elegant solution that requires > both true multiple inheritance of classes (which pretty much limits my > language choices to C++ and Python) and type-based function > overloading. > > Now, while this makes it sound like I have to re

Re: Function Overloading and Python

2008-02-25 Thread Gerald Klix
Stefan Behnel schrieb: > Allen Peloquin wrote: >> On Feb 24, 11:44 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: >>> Allen Peloquin wrote: class B { fun(A x, A y, A z)... fun(A1 x, A y, A z)... } class B1 { fun(A1 x, A y, A z)... } Such t

print help content in a Command Prompt

2008-02-25 Thread bkamrani
Hi, This is a basic problem, but I want to print help content in a Command Prompt in WinXP and scrolling back to see the first lines. If I start a command prompt and run python, and then for example, >>> help(list) it starts showing the help, which can be controlled by page or raw using Spacebar

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
On 25 Feb, 09:51, 7stud <[EMAIL PROTECTED]> wrote: > I have the following two identical clients > > #test1.py:--- > import socket > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > host = 'localhost' > port = 5052  #server port > > s.connect((host, port)) > print s.getsockname()

Re: How about adding rational fraction to Python?

2008-02-25 Thread M.-A. Lemburg
If you're interested in rationals, then you might want to have a look at mxNumber which is part of the eGenix mx Experimental Distribution: http://www.egenix.com/products/python/mxExperimental/mxNumber/ It provides fast rational operations based on the GNU MP library. On 2008-02-25 07:58, Carl B

Re: integrating python with owl

2008-02-25 Thread Robert Bossy
Noorhan Abbas wrote: > Hello, > I have developed an ontology using protege owl and I wonder if you > can help me get any documentation on how to integrate it with python. > Hi, It depends on what you mean by integrating. If you mean reading OWL files generated by Protégé, there are some Pyth

Re: print help content in a Command Prompt

2008-02-25 Thread Chris
On Feb 25, 11:15 am, [EMAIL PROTECTED] wrote: > Hi, > This is a basic problem, but I want to print help content in a Command > Prompt in WinXP and scrolling back to see the first lines. If I start > a command prompt and run python, and then for example, > > >>> help(list) > > it starts showing the

Re: Weird cgi error

2008-02-25 Thread marti john
GET YOUR SITE LISTET AT GOOGLE & YAHOO "NR.1" SEARCH RESULT for FREE Now BEST CHANCE EVER 2 GET TONZ OF SIGN UPS IN UR DOWNLINE !!! CLICK IT DON'T MISS MAKE 16.000 Dollars Every Fcuckng Month ! Click Don't Miss it !! Jesse Aldridge <[EMAIL PROTECTED]> wrote: I uploaded the following script

Re: check a directory

2008-02-25 Thread Robert Bossy
Raj kumar wrote: > Hi all, > I'm using following code... > > for x in listdir(path) > some code. > > but how i can check whether x is a directory or not? > Because listdir() is giving all the files present in that path Take a look at the module os.path, especially the functions named is

Large file support >2/4GB ?

2008-02-25 Thread robert
Somebody who uses my app gets a error : os.stat('/path/filename') OSError: [Errno 75] Value too large for defined data type: '/path/filename' on a big file >4GB ( Python 2.4.4 / Linux ) How about that? Does Python not support large files? Or which functions do not support? Robert -- http:/

Re: Question about PyPI and 'easy_install'

2008-02-25 Thread Richard Jones
makoto kuwata wrote: > Is it required to set registered name (Tenjin) and > package name (pyTenjin) into same name? Yes. How did you upload those files with a different name to that pypi package? Richard -- http://mail.python.org/mailman/listinfo/python-list

Parent instance attribute access

2008-02-25 Thread Gabriel Rossetti
Hello, I have something weird going on, I have the following (simplified) : class MyFactory(..., ...): def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs ... class MyXmlFactory(MyFactory): def __init__(self, *args, **kwargs): MyFa

Re: float / rounding question

2008-02-25 Thread sabatier
On Feb 25, 10:44 am, [EMAIL PROTECTED] wrote: > Hi I'm very much a beginner with Python. > I want to write a function to convert celcius to fahrenheit like this > one: > > def celciusToFahrenheit(tc): > tf = (9/5)*tc+32 > return tf > > I want the answer correct to one decimal place, so > ce

Re: Parent instance attribute access

2008-02-25 Thread Robert Bossy
Gabriel Rossetti wrote: > Hello, > > I have something weird going on, I have the following (simplified) : > > class MyFactory(..., ...): > > def __init__(self, *args, **kwargs): > self.args = args > self.kwargs = kwargs > ... > > class MyXmlFactory(MyFactory): > > de

check a directory

2008-02-25 Thread Raj kumar
Hi all, I'm using following code... for x in listdir(path) some code. but how i can check whether x is a directory or not? Because listdir() is giving all the files present in that path Thanks in advance. Did you know? You can CHAT without downloading messenger. Go to http

float / rounding question

2008-02-25 Thread helen . m . flynn
Hi I'm very much a beginner with Python. I want to write a function to convert celcius to fahrenheit like this one: def celciusToFahrenheit(tc): tf = (9/5)*tc+32 return tf I want the answer correct to one decimal place, so celciusToFahrenheit(12) would return 53.6. Of course the function

Re: How about adding rational fraction to Python?

2008-02-25 Thread Jorge Godoy
Paul Rubin wrote: > Carl Banks <[EMAIL PROTECTED]> writes: >> Try doing numerical integration sometime with rationals, and tell me >> how that works out. Try calculating compound interest and storing >> results for 1000 customers every month, and compare the size of your >> database before and af

Re: float / rounding question

2008-02-25 Thread Jorge Godoy
sabatier wrote: > On Feb 25, 10:44 am, [EMAIL PROTECTED] wrote: >> Hi I'm very much a beginner with Python. >> I want to write a function to convert celcius to fahrenheit like this >> one: >> >> def celciusToFahrenheit(tc): >> tf = (9/5)*tc+32 >> return tf >> >> I want the answer correct t

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: > On 25 Feb, 09:51, 7stud <[EMAIL PROTECTED]> wrote: > > > > > I have the following two identical clients > > > #test1.py:--- > > import socket > > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > > host = 'localhost' > > port = 5052  

Re: Is there a open souce IDE writen by C( C++) or partly writen by C( C++)?

2008-02-25 Thread zaley
On 2月25日, 下午12时02分, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > zaley wrote: > > On 2月25日, 上午10时35分, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > >> zaley wrote: > > So I hope I can find something helpful in open source IDE for python. > Exactly so. PyScripter does it easy, besides you can ha

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: > > by reusing the same variables without storing the previous values. > This could make the Python > garbage collector to attempt freeing the socket object created with > the first connection, therefore > closing the connection. > > If I'm right, your p

Re: Is crawling the stack "bad"? Why?

2008-02-25 Thread Boris Borcic
Paul Rubin wrote: > Russell Warren <[EMAIL PROTECTED]> writes: >> That is exactly where I started (creating my own request handler, >> snagging the IP address and stashing it), but I couldn't come up with >> a stash location that would work for a threaded server. > > How about a dictionary indexed

[Newbie] Is there any method to urlretrieve to a file the html source from a url with "Transfer-encoding": chunked

2008-02-25 Thread Aldo Ceccarelli
Hello All, I apologize for posting a question on this but I could not find a complete answer after reading and searching so far:-) My problem is that I'd like to store the html source of a certain web url but when I try via urllib / urllib2 reads or urlretrieve I get only a part of the contents (i

Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread Doug Morse
Hi, My apologies for troubling for what is probably an easy question... it's just that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... I have a class method, MyClass.foo(), that takes keyword arguments. For example, I can say: x = MyClass() x.foo(trials=32) Works just

Re: Parent instance attribute access

2008-02-25 Thread marek . rocki
Hello. Please post the minimal code that can be run and demonstrates what's wrong. I tried the following and it works fine, args and kwargs are visible: class MyFactory(object): def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs clas

Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Romano Giannetti
Hi, while writing some LaTeX preprocessing code, I stumbled into this problem: (I have a -*- coding: utf-8 -*- line, obviously) s = ur"añado $\uparrow$" Which gave an error because the \u escape is interpreted in raw unicode strings, too. So I found that the only way to solve this is to write

Re: print help content in a Command Prompt

2008-02-25 Thread Necmettin Begiter
25 February 2008 Monday 11:15:14 tarihinde [EMAIL PROTECTED] şunları yazmıştı: > Hi, > This is a basic problem, but I want to print help content in a Command > Prompt in WinXP and scrolling back to see the first lines. If I start > a command prompt and run python, and then for example, > > >>> hel

Re: float / rounding question

2008-02-25 Thread Necmettin Begiter
25 February 2008 Monday 12:44:46 tarihinde [EMAIL PROTECTED] şunları yazmıştı: > Hi I'm very much a beginner with Python. > I want to write a function to convert celcius to fahrenheit like this > one: > > def celciusToFahrenheit(tc): > tf = (9/5)*tc+32 > return tf > > I want the answer co

Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL

2008-02-25 Thread SPE - Stani's Python Editor
On 22 feb, 15:36, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > On Feb 22, 1:41 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > I'm confused. What needs to be compiled exactly? Are there any > > > directions? I'm not seeing any at that website. I can give it a go if > > > someone can give me adv

Re: Question about PyPI and 'easy_install'

2008-02-25 Thread makoto kuwata
On 2008-02-25, Richard Jones <[EMAIL PROTECTED]> wrote: > makoto kuwata wrote: > > Is it required to set registered name (Tenjin) and > > package name (pyTenjin) into same name? > > Yes. > Thank you, Richard. Your answer helps me very much. > How did you upload those files with a different name

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 4:08 am, 7stud <[EMAIL PROTECTED]> wrote: > > The question I'm really trying to answer is: if a client connects to a > host at a specific port, but the server changes the port when it > creates a new socket with accept(), how does data sent by the client > arrive at the correct port?  Wo

Re: print help content in a Command Prompt

2008-02-25 Thread bkamrani
On Feb 25, 12:59 pm, Necmettin Begiter <[EMAIL PROTECTED]> wrote: > 25 February 2008 Monday 11:15:14 tarihinde [EMAIL PROTECTED] şunları yazmıştı: > > > Hi, > > This is a basic problem, but I want to print help content in a Command > > Prompt in WinXP and scrolling back to see the first lines. If I

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
> > The question I'm really trying to answer is: if a client connects to a > host at a specific port, but the server changes the port when it > creates a new socket with accept(), how does data sent by the client > arrive at the correct port?  Won't the client be sending data to the > original por

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread John Machin
On Feb 25, 10:42 pm, Doug Morse <[EMAIL PROTECTED]> wrote: > Hi, > > My apologies for troubling for what is probably an easy question... it's just > that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... > > I have a class method, MyClass.foo(), that takes keyword arguments.

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread bockman
On 25 Feb, 12:42, Doug Morse <[EMAIL PROTECTED]> wrote: > Hi, > > My apologies for troubling for what is probably an easy question... it's just > that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... > > I have a class method, MyClass.foo(), that takes keyword arguments.  F

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread Bruno Desthuilliers
Doug Morse a écrit : > Hi, > > My apologies for troubling for what is probably an easy question... it's just > that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... > > I have a class method, MyClass.foo(), that takes keyword arguments. For > example, I can say: > > x =

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 5:17 am, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 25, 4:08 am, 7stud <[EMAIL PROTECTED]> wrote: > > > > > The question I'm really trying to answer is: if a client connects to a > > host at a specific port, but the server changes the port when it > > creates a new socket with accept(), h

Re: ANN: Strangle 0.3.0 DNS parsing library based on BIND9

2008-02-25 Thread Nick Craig-Wood
Jason Smith <[EMAIL PROTECTED]> wrote: > This message is to announce a python module, Strangle, which provides a > convenient way for mere mortals to parse DNS packets in Python, based on > the mature functionality of BIND 9. > > http://www.proven-corporation.com/software/strangle/ > > Str

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread Doug Morse
On Mon, 25 Feb 2008 04:20:37 -0800 (PST), John Machin <[EMAIL PROTECTED]> wrote: > On Feb 25, 10:42 pm, Doug Morse <[EMAIL PROTECTED]> wrote: > > Hi, > > > > My apologies for troubling for what is probably an easy question... it's > > just > > that can't seem to find an answer to this anywhere (G

pprint, __repr__ and inheritance, how does it works?

2008-02-25 Thread Jorge Vargas
Hello list, I'm having a little bit of trouble making this all work together. I have a base class in which I want to define the __repr__ for all subclasses which in this case will be to output all the __dict__ atributes. Using [1] as reference I have come up with the following but it has 2 problem

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Carl Banks
On Feb 24, 7:03 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Jeff Schwab <[EMAIL PROTECTED]> wrote: > >(3) Garbage collection is at least as desirable a language feature as > >deterministic destruction. > > Enh. There probably are some people who claim that, but I can't

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Diez B. Roggisch
Romano Giannetti wrote: > Hi, > > while writing some LaTeX preprocessing code, I stumbled into this problem: > (I have a -*- coding: utf-8 -*- line, obviously) > > s = ur"añado $\uparrow$" > > Which gave an error because the \u escape is interpreted in raw unicode > strings, too. So I found tha

Re: Function Overloading and Python

2008-02-25 Thread Carl Banks
On Feb 25, 2:33 am, Allen Peloquin <[EMAIL PROTECTED]> wrote: > I have a personal project that has an elegant solution that requires > both true multiple inheritance of classes (which pretty much limits my > language choices to C++ and Python) and type-based function > overloading. > > Now, while t

Re: Adding Priority Scheduling feature to the subprocess

2008-02-25 Thread TimeHorse
On Feb 22, 4:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Interestingly enough this was changed in recent linux kernels. > Process levels in linus kernels are logarithmic now, whereas before > they weren't (but I wouldn't like to say exactly what!). Wow! That's a VERY good point. I ran a

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Thinker
Romano Giannetti wrote: > Hi, > > while writing some LaTeX preprocessing code, I stumbled into this > problem: (I have a -*- coding: utf-8 -*- line, obviously) > > s = ur"añado $\uparrow$" > > Which gave an error because the \u escape is interpreted in raw > unicode strings, too. So I found that th

Re: Weird cgi error

2008-02-25 Thread Gerardo Herzig
Jesse Aldridge wrote: >I uploaded the following script, called "test.py", to my webhost. >It works find except when I input the string "python ". Note that's >the word "python" followed by a space. If I submit that I get a 403 >error. It seems to work fine with any other string. >What's going o

Re: [Newbie] Is there any method to urlretrieve to a file the html source from a url with "Transfer-encoding": chunked

2008-02-25 Thread Thinker
Aldo Ceccarelli wrote: > Hello All, > I apologize for posting a question on this but I could not find a > complete answer after reading and searching so far:-) > > My problem is that I'd like to store the html source of a certain web > url but when I try via urllib / urllib2 reads or urlretrieve I

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Romano Giannetti
Thinker branda.to> writes: > > > > s = ur"añado $\uparrow$" > > > > Which gave an error because the \u escape is interpreted in raw > > unicode strings, too. So I found that the only way to solve this is > > to write: > > > > s = unicode(r"añado $\uparrow$", "utf-8") > > > > or > > > > s = ur"

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Nicola Musatti
On Feb 24, 1:01 am, Paul Rubin wrote: > Nicola Musatti <[EMAIL PROTECTED]> writes: > > >>>a = [f(x) + g(y) for x,y in izip(m1, m2) if h(x,y).frob() == 7] > > [...] > > > There you replace one line of code with 40+ lines to get around the > > > absence of GC. Sounds b

Re: float / rounding question

2008-02-25 Thread casevh
On Feb 25, 2:44 am, [EMAIL PROTECTED] wrote: > Hi I'm very much a beginner with Python. > I want to write a function to convert celcius to fahrenheit like this > one: > > def celciusToFahrenheit(tc): > tf = (9/5)*tc+32 > return tf > > I want the answer correct to one decimal place, so > cel

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Nicola Musatti
On Feb 24, 9:14 pm, Larry Bugbee <[EMAIL PROTECTED]> wrote: > On Feb 21, 10:22 am, Nicola Musatti <[EMAIL PROTECTED]> wrote: > > > On Feb 21, 6:31 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > The main reason why C++ has declined in usage is because almost > > > everything of practical value i

Re: Parent instance attribute access

2008-02-25 Thread Gabriel Rossetti
[EMAIL PROTECTED] wrote: > Hello. Please post the minimal code that can be run and demonstrates > what's wrong. I tried the following and it works fine, args and kwargs > are visible: > > class MyFactory(object): > def __init__(self, *args, **kwargs): > self.args = args >

Re: Last 4 Letters of String

2008-02-25 Thread Tim Chase
> How would you get the last 4 items of a list? Did you try the same "get the last 4 items" solution that worked for a string? lst[-4:] -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Large file support >2/4GB ?

2008-02-25 Thread Chris
On Feb 25, 12:35 pm, robert <[EMAIL PROTECTED]> wrote: > Somebody who uses my app gets a error : > > os.stat('/path/filename') > > OSError: [Errno 75] Value too large for defined data type: > '/path/filename' > > on a big file >4GB > > ( Python 2.4.4 / Linux ) > > How about that? Does Python not su

Re: Python for web...

2008-02-25 Thread Berco Beute
> Use mod_python if you can. Although mod_python is fine, I had more success using fastcgi with Django (you can run Django as a fastcgi process). It was less troublesome to set up and the chances your hosting provider supports it are bigger. 2B -- http://mail.python.org/mailman/listinfo/python-l

Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL

2008-02-25 Thread Mike Driscoll
Hi, > > I have Visual Studio 6 and .NET 2003 so I think I'm good for that. > > I am not sure you even need it. I found here some more instructions > for another project which uses libexiv2, which seems to be quite > straightforward:http://albumshaper.wiki.sourceforge.net/Compiling+on+Windows > >

Re: simpleparse - what is wrong with my grammar?

2008-02-25 Thread Laszlo Nagy
>> > You've created an infinitely recursing grammar. SimpleParse is a > straightforward recursive descent parser without look-ahead (unless > explicitly coded) or ambiguity resolution. You are asking it to parse > "expr" to see if "expr,binop,expr" is matched. It will continue > recursing

os.fork() not working on windows (help)

2008-02-25 Thread A. Joseph
Please i`m trying to create a process using the os.fork() but it keep generating error that the os module has no attribute called 'fork()'. what should i do? or is the os.fork() method not for windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Carl Banks
On Feb 25, 8:29 am, Nicola Musatti <[EMAIL PROTECTED]> wrote: > On Feb 24, 9:14 pm, Larry Bugbee <[EMAIL PROTECTED]> wrote: > > Corporate marketing, and corporate attention in general, saw to it > > that Java was well equipped with libraries and frameworks addressing > > enterprise application need

Re: object identity and hashing

2008-02-25 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 24, 9:28 pm, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Feb 24, 9:11 pm, [EMAIL PROTECTED] wrote: >> >> >> >> >> >>> On Feb 24, 7:58 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: > Can someone explain this? a= {} Cre

Array of functions, Pythonically

2008-02-25 Thread MartinRinehart
My parser has found an expression of the form CONSTANT_INTEGER OPERATOR CONSTANT_INTEGER. I want to fold this into a single CONSTANT_INTEGER. The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc. In C I'd put functions Add, Subtract, ... into an array and call ArithmeticFunctions[

Re: Using lambda [was Re: Article of interest: Python pros/cons for theenterprise]

2008-02-25 Thread Steven D'Aprano
On Sun, 24 Feb 2008 21:13:08 -0500, Terry Reedy wrote: > | I even use "named anonymous functions" *cough* by assigning lambda | > functions to names: > | > | foo = lambda x: x+1 > > Even though I consider the above to be clearly inferior to > > def foo(x): return x+1 > > since the latter names

Re: float / rounding question

2008-02-25 Thread Sion Arrowsmith
Necmettin Begiter <[EMAIL PROTECTED]> wrote: >25 February 2008 Monday 12:44:46 tarihinde [EMAIL PROTECTED] =C5=9Fun= >lar=C4=B1 yazm=C4=B1=C5=9Ft=C4=B1: >> Of course the function above returns 53.601. >>=20 >> How do I format it correctly? > >Use the round(number,digits) function: > >t

Re: How about adding rational fraction to Python?

2008-02-25 Thread Mensanator
On Feb 25, 12:58�am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Feb 24, 10:56 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > But that doesn't mean they become less manageable than > > other unlimited precision usages. Did you see my example > > of the polynomial finder using Newton's Forward Diffe

RE: Last 4 Letters of String

2008-02-25 Thread Reedick, Andrew
> -Original Message- > From: Tim Chase [mailto:[EMAIL PROTECTED] > Sent: Monday, February 25, 2008 8:34 AM > To: Reedick, Andrew > Cc: Robert Rawlins - Think Blue; python-list@python.org > Subject: Re: Last 4 Letters of String > > > How would you get the last 4 items of a list? > > Did

Re: simpleparse - what is wrong with my grammar?

2008-02-25 Thread Mike C. Fletcher
Laszlo Nagy wrote: ... > Is there any way I can specify precedence tables? Or do I have to use > a different parser generator then? You normally specify them as top_precedence/second_precedence/last_precedence sets. SimpleParse' limitation is with ambiguity, not with precedence. SimpleParse wi

Re: Array of functions, Pythonically

2008-02-25 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > My parser has found an expression of the form CONSTANT_INTEGER > OPERATOR CONSTANT_INTEGER. I want to fold this into a single > CONSTANT_INTEGER. > > The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc. > In C I'd put functions Add, Subtract, ... into a

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Sebastian Kaliszewski
Jeff Schwab wrote: >> You like managing your own memory, be my guest. But please don't >> imply that you're putting forth less effort because of it. You're >> just putting forth different effort. > > I disagree with you completely. Your points don't make any sense to me > at all. I believe I a

Re: How about adding rational fraction to Python?

2008-02-25 Thread Steven D'Aprano
On Sun, 24 Feb 2008 23:41:53 -0800, Dennis Lee Bieber wrote: > On 24 Feb 2008 23:04:14 -0800, Paul Rubin > declaimed the following in comp.lang.python: > > >> Usually you would round to the nearest penny before storing in the >> database. > > Tell that to the pa

Re: How about adding rational fraction to Python?

2008-02-25 Thread Steven D'Aprano
On Sun, 24 Feb 2008 23:09:39 -0800, Carl Banks wrote: > On Feb 25, 2:04 am, Paul Rubin wrote: >> Carl Banks <[EMAIL PROTECTED]> writes: >> > Try doing numerical integration sometime with rationals, and tell me >> > how that works out. Try calculating compound interest a

Re: os.fork() not working on windows (help)

2008-02-25 Thread Christian Heimes
A. Joseph wrote: > Please i`m trying to create a process using the os.fork() but it keep > generating error that the os module has no attribute called 'fork()'. what > should i do? > > or is the os.fork() method not for windows? Windows doesn't have a fork() syscall. It's only available on UNIX.

Problem with threads in python????????

2008-02-25 Thread Manikandan R
Hai, Is it possible to share a single variable between multiple threads. For eg: Class A: thread_init() def run(): fun1() def fun(): assume some arithmatic operation is going on according to the input given and each fun will *give different outp

Re: Python for web...

2008-02-25 Thread Ivan Van Laningham
Hi All-- I didn't have any trouble setting up mod_python & Django. However, I am my own hosting provider. That may make a difference. ;-) I can install fastcgi if it's a big win. Metta, Ivan On Mon, Feb 25, 2008 at 6:48 AM, Berco Beute <[EMAIL PROTECTED]> wrote: > > Use mod_python if you can.

Re: object identity and hashing

2008-02-25 Thread castironpi
> But this doesn't tell you anything about Python except that it's > flexible enough to construct counter-intuitive classes. > > Everything you have been told is true for the normal cases you will come > across in everyday usage. If you want to play in the obscure corners of > the language that's f

Re: Using lambda [was Re: Article of interest: Python pros/cons for theenterprise]

2008-02-25 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 24 Feb 2008 21:13:08 -0500, Terry Reedy wrote: > >> | I even use "named anonymous functions" *cough* by assigning lambda | >> functions to names: >> | >> | foo = lambda x: x+1 >> >> Even though I consider the above to be clearly inferior to >

Re: float / rounding question

2008-02-25 Thread Mel
[EMAIL PROTECTED] wrote: > Hi I'm very much a beginner with Python. > I want to write a function to convert celcius to fahrenheit like this > one: > > def celciusToFahrenheit(tc): > tf = (9/5)*tc+32 > return tf > > I want the answer correct to one decimal place, so > celciusToFahrenheit(1

Re: Article of interest: Python pros/cons for the enterprise

2008-02-25 Thread Paul Rubin
Nicola Musatti <[EMAIL PROTECTED]> writes: > > However, one of the consequences of programming in this style is > > you allocate a lot of temporary objects which best managed by GC. > > According to which metric? This statement appears as totally > gratuitous to me. You seem to forget that dealloc

Re: Is there any method to urlretrieve to a file the html source from a url with "Transfer-encoding": chunked

2008-02-25 Thread Aldo Ceccarelli
Thank you All for your suggestions: I could finally assess that besides partial read from chunked url - by-passed thanks to a socket approach: f.i. this was good for me: http://python.about.com/od/networkingwithpython/ss/beg_web_client_9.htm I have still two kind of problems that quit this pos

Re: Function Overloading and Python

2008-02-25 Thread castironpi
On Feb 25, 1:33 am, Allen Peloquin <[EMAIL PROTECTED]> wrote: > I have a personal project that has an elegant solution that requires > both true multiple inheritance of classes (which pretty much limits my > language choices to C++ and Python) and type-based function > overloading. > > Now, while t

Re: ANN: NUCULAR B3 Full text indexing (now on Win32 too)

2008-02-25 Thread Aaron Watters
On Feb 22, 5:31 pm, Paul Rubin wrote: > Aaron Watters <[EMAIL PROTECTED]> writes: > > 3) ...I was thinking > > of adding an optional feature to Nucular which would allow > > a look-up like "given a word find all attributes that contain > > that word anywhere and give a co

Re: Python for web...

2008-02-25 Thread Tim Chase
> I didn't have any trouble setting up mod_python & Django. However, I > am my own hosting provider. That may make a difference. ;-) > > I can install fastcgi if it's a big win. From my understanding, the python-code under mod_python runs as whatever Apaches runs as ("www", "wwwdata", whateve

Re: Is crawling the stack "bad"? Why?

2008-02-25 Thread Russell Warren
> How about a dictionary indexed by by the thread name. Ok... a functional implementation doing precisely that is at the bottom of this (using thread.get_ident), but making it possible to hand around this info cleanly seems a bit convoluted. Have I made it more complicated than I need to? There

Re: Using lambda [was Re: Article of interest: Python pros/cons for theenterprise]

2008-02-25 Thread Steven D'Aprano
On Mon, 25 Feb 2008 15:12:23 +, Duncan Booth wrote: > I take it you never feel the need to inspect tracebacks, nor insert a > breakpoint or print statement at an arbitrary point in the code. Nah, my code is always perfect, first time, every time. *wink* > Granted none of those may apply i

Re: How about adding rational fraction to Python?

2008-02-25 Thread M.-A. Lemburg
On 2008-02-25 16:03, Steven D'Aprano wrote: > On Sun, 24 Feb 2008 23:09:39 -0800, Carl Banks wrote: > >> On Feb 25, 2:04 am, Paul Rubin wrote: >>> Carl Banks <[EMAIL PROTECTED]> writes: Try doing numerical integration sometime with rationals, and tell me how th

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread Gary Herron
Doug Morse wrote: > Hi, > > My apologies for troubling for what is probably an easy question... it's just > that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... > > I have a class method, MyClass.foo(), that takes keyword arguments. For > example, I can say: > > x = MyCla

Re: Using lambda [was Re: Article of interest: Python pros/cons for theenterprise]

2008-02-25 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> but if >> you pass functions/lambdas around a lot it can be frustrating when you >> get an error such as: >> >> TypeError: () takes exactly 2 arguments (1 given) >> >> and the traceback only tells you which line generated the TypeError, not >> wh

Re: Array of functions, Pythonically

2008-02-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > My parser has found an expression of the form CONSTANT_INTEGER > OPERATOR CONSTANT_INTEGER. I want to fold this into a single > CONSTANT_INTEGER. > > The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc. > In C I'd put functions Add, Subtract, ... into

RE: Large file support >2/4GB ?

2008-02-25 Thread Brian Smith
Chris wrote: > On Feb 25, 12:35 pm, robert <[EMAIL PROTECTED]> wrote: > > Somebody who uses my app gets a error : > > > > os.stat('/path/filename') > > > > OSError: [Errno 75] Value too large for defined data type: > > '/path/filename' > > > > on a big file >4GB > > > > ( Python 2.4.4 / Linux ) > >

PyEuler

2008-02-25 Thread bearophileHUGS
This is the first time I write something that looks like a little rant :-) Surely I'll be wrong in many points, but I presume this isn't going to damage people, so... Here there are some functional Python solutions to some Euler problems: http://pyeuler.wikidot.com/ Some pieces of that code: def

Re: How about adding rational fraction to Python?

2008-02-25 Thread Grant Edwards
On 2008-02-25, Carl Banks <[EMAIL PROTECTED]> wrote: > In other words, 3/4 in Python rightly yields a float Unless you're in the camp that believes 3/4 should yield the integer 0. ;) > and not a rational. -- Grant Edwards grante Yow! Zippy's brain cells

mx Base module

2008-02-25 Thread Manu
Hi there, I am trying to install mx Base module( http://www.egenix.com/products/python/mxBase/ ) on my Redhat server. But om executing command "python setup.py install" I get following messages: running install running build running mx_autoconf gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3

String compare question

2008-02-25 Thread Robert Dailey
Hi, Currently I have the following code: ignored_dirs = ( r".\boost\include" ) if __name__ == "__main__": # Walk the directory tree rooted at 'source' for root, dirs, files in os.walk( source ): if root not in ignored_dirs: CopyFiles( root, files, ".dll" )

Re: How about adding rational fraction to Python?

2008-02-25 Thread Steve Holden
Grant Edwards wrote: > On 2008-02-25, Carl Banks <[EMAIL PROTECTED]> wrote: > >> In other words, 3/4 in Python rightly yields a float > > Unless you're in the camp that believes 3/4 should yield the > integer 0. ;) > >> and not a rational. > No, that wouldn't be rational ;-) -- Steve Holden

Re: String compare question

2008-02-25 Thread Gary Herron
Robert Dailey wrote: > Hi, > > Currently I have the following code: > > > ignored_dirs = ( > r".\boost\include" > ) You expect this is creating a tuple (or so I see from your "in" test in the following code), but in fact the parenthesis do *not* make a tuple. If you look at ignored_dirs, y

Re: Pydev/Eclipse: How to add filters for the navigator ?

2008-02-25 Thread Fabio Zadrozny
It's an eclipse bug in 3.3.1.1: see: http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/msg28728.html and the follow up: http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/msg28733.html (until then you can use the pydev package explorer / project explorer). Cheers, Fabio On Sun,

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread romano . giannetti
> unicode(r"\uparrow", "utf-8") will break... sigh. > Moreover, I checked with 2to3.py, and it say (similar case): -ok_preamble = unicode(r""" +ok_preamble = str(r""" \usepackage[utf8]{inputenc} \begin{document} Añadidos: """, "utf-8") which AFAIK will give an error for the \u in \usepackag

Re: How about adding rational fraction to Python?

2008-02-25 Thread Carl Banks
On Feb 25, 9:41 am, Mensanator <[EMAIL PROTECTED]> wrote: > On Feb 25, 12:58�am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Feb 24, 10:56 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > But that doesn't mean they become less manageable than > > > other unlimited precision usages. Did you

  1   2   3   >