Re: import reassignment different at module and function scope

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 05:31:47 -0200, Brendan Miller escribió: 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? Python doesn't have local

Re: is python Object oriented??

2009-01-31 Thread Laszlo Nagy
M Kumar wrote: Object oriented languages doesn't allow execution of the code without class objects, what is actually happening when we execute some piece of code, is it bound to any class? Those who have time and consideration can help me There are many kinds of definitions for "object orient

HTTPSConnection: client certificate auth

2009-01-31 Thread Mailing List SVR
Hi all, I have a soap client using ZSI, the other end is oracle soa 10.1.3.1.0 all works fine since some months. The last week oracle soa was configured to accept client certificate authentication over https. If I try to use the standard python httplib.HTTPSConnection library it fails with the inf

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

2009-01-31 Thread Hongyi Zhao
On Sat, 31 Jan 2009 04:10:39 -0200, "Gabriel Genellina" wrote: >En Fri, 30 Jan 2009 12:53:33 -0200, Hongyi Zhao >escribi$)A(.: > >>> See the following errors I in my case: >>> >>> $ python >>> 'import site' failed; use -v for traceback > >> import socket >>> Traceback (most recent call

Re: search speed

2009-01-31 Thread anders
Tanks everyone that spent time helping my, the help was great. Best regards Anders -- http://mail.python.org/mailman/listinfo/python-list

How to manipulate a contents of file as record structures

2009-01-31 Thread CK Raju
I have a text file containing the following alphanumerals. aa2255 hh11dpdpdpdp22 kkk21lokolkolko33 . I need to read the contents as single line, one after the other and append the sum of digits at the end. aa225577 hh11dpdpdpdp2233 kkk21lokolkolko3354 ..

Re: How to manipulate a contents of file as record structures

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 08:35:44 -0200, CK Raju escribió: I have a text file containing the following alphanumerals. aa2255 hh11dpdpdpdp22 kkk21lokolkolko33 . I need to read the contents as single line, one after the other and append the sum of digits at the end. aa22

Re: How to manipulate a contents of file as record structures

2009-01-31 Thread CK Raju
On Sat, Jan 31, 2009 at 4:19 PM, Gabriel Genellina wrote: > for line in f: > do_something_with(line) Thanks a lot. CK Raju -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-01-31 Thread MC
Re ‘builtin’ is not a class. I think "object" ; not only "class" And "builtin" is an object. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-31 Thread Aaron Brady
On Jan 31, 1:08 am, "Hendrik van Rooyen" wrote: > "Gabriel Genellina" wrote: snip > >or even like this: > > >def foo(L, M, A): > >   for x in L: > >     for y in M: > >       yield x+A > >g = foo(iter(L), iter(M), A) > > >In particular, I like the 2nd (all late binding). Seems this topic was   >

Re: SimpleXMLRPCServer question

2009-01-31 Thread andrew cooke
On Jan 30, 11:59 pm, flagg wrote: > 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 [...] at the risk of repeating what the other guy

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

2009-01-31 Thread Marc 'BlackJack' Rintsch
On Fri, 30 Jan 2009 21:59:34 +0100, Stef Mientki wrote: > 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 ) :

Where to host a (Python) project?

2009-01-31 Thread andrew cooke
Hi, I have a new project, that I just released in beta (http:// www.acooke.org/lepl - a recursive decent parser with full backtracking). At the moment I am using pypi and setuptools for distribution (it's a pure python package) and I am happy with hosting static web pages (the manual and api doc

Why do operators and methods of built-in types differ

2009-01-31 Thread Csaba Hoch
Hi, if I write the following: >>> 1+1 2 it seems to be exactly equivalent to this: >>> (1).__add__(1) 2 However, if I write invalid code and try to add a list to an int, the errors will be different: >>> 1+[] Traceback (most recent call last): File "", line 1, in T

Empty string is False right?

2009-01-31 Thread AJ Ostergaard
Hello, First post so bear with me if I'm being a numpty ... Is it me or is there something slightly counter intuitive and thus not so pythonesque about this: >>> s = '' >>> if s: True ... else: False ... False >>> s and eval(s) '' >>> Regards, AJ -- http://mail.python.org/mailman/listinfo/

Re: Empty string is False right?

2009-01-31 Thread Ralf Schoenian
AJ Ostergaard wrote: Hello, First post so bear with me if I'm being a numpty ... Is it me or is there something slightly counter intuitive and thus not so pythonesque about this: >>> s = '' >>> if s: True else: False False >>> s and eval(s) '' >>> Regards, AJ Hi, yes, the

Re: Empty string is False right?

2009-01-31 Thread AJ Ostergaard
Hi Ralf, Thanks for that but why: >>> '' and True '' Surely that should be False?!? Regards, AJ On 31 Jan 2009, at 12:12, Ralf Schoenian wrote: AJ Ostergaard wrote: Hello, First post so bear with me if I'm being a numpty ... Is it me or is there something slightly counter intuitive and th

Re: nth root

2009-01-31 Thread Mark Dickinson
On Jan 31, 5:43 am, "Tim Roberts" wrote: > 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 bet

Re: Empty string is False right?

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 10:16:19 -0200, AJ Ostergaard escribió: Hi Ralf, Thanks for that but why: >>> '' and True '' Surely that should be False?!? Python does "short-circuit evaluation" [1] "and" and "or" return one of its operands as soon as the outcome is determined, not just True or F

Re: Empty string is False right?

2009-01-31 Thread Vlastimil Brom
2009/1/31 AJ Ostergaard : > Hi Ralf, > > Thanks for that but why: > '' and True > '' > > Surely that should be False?!? > > Regards, > AJ > > see the docs: http://docs.python.org/reference/expressions.html#boolean-operations "The expression x and y first evaluates x; if x is false, its value

Re: Empty string is False right?

2009-01-31 Thread Bernd Nawothnig
On 2009-01-31, AJ Ostergaard wrote: > Thanks for that but why: '' and True > '' > Surely that should be False?!? It is: #v+ >>> bool('' and True) False #v- Bernd -- No time toulouse -- http://mail.python.org/mailman/listinfo/python-list

Re: Empty string is False right?

2009-01-31 Thread John Machin
On Jan 31, 11:12 pm, Ralf Schoenian wrote: > yes, the following evaluates to False: A much better way of describing the effect would be to say that the following are treated as false (no capital letter!) in a conditional context. > empty String: '' > empty list: [] > empty tuple: () > empty dic

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread andrew cooke
On Jan 31, 8:51 am, Csaba Hoch wrote: > What is the reason behind this difference between the __add__ operator > and int.__add__? this is quite common in python. the special methods like __add__ are used to implement some functionality (like '+' in this case), but they are not all of it. for ex

Re: Empty string is False right?

2009-01-31 Thread AJ Ostergaard
I'm not suggesting it's not operating as advertised - I'm suggesting the 'advertising' is slightly sguiffy if you catch my drift. I guess it's just me that finds it slightly counter intuitive. Surely intuitively the expression is "and" and therefore should always return a boolean? I'll sh

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 09:51:35 -0200, Csaba Hoch escribió: if I write the following: >>> 1+1 2 it seems to be exactly equivalent to this: >>> (1).__add__(1) 2 However, if I write invalid code and try to add a list to an int, the errors will be different: >>> 1+[] Tr

Re: Empty string is False right?

2009-01-31 Thread John Machin
On Jan 31, 11:16 pm, AJ Ostergaard wrote: > Hi Ralf, > > Thanks for that but why: > >  >>> '' and True > '' > > Surely that should be False?!? No, deliberately not. Read this for Python 3.0 http://docs.python.org/3.0/reference/expressions.html#boolean-operations and/or this for Python 2.X http://

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread Csaba Hoch
Gabriel Genellina wrote: The operator "+" does more than blindy calling left.__add__(right). In this case, as int + list returns NotImplemented, it reverses the operands and tries right.__radd__(left), and only then it gives up and raises TypeError. The actual rules are a bit more complex, in

Re: Where to host a (Python) project?

2009-01-31 Thread Martin
Hi, 2009/1/31 andrew cooke : > However, i am thinking I could really do with: > - a mailing list > - simple bug tracking > - subversion > and am wondering which is the best (free) provider for these (the code > is LGPL open source). I'd prefer a mailing list to something like > google groups (alt

Re: Empty string is False right?

2009-01-31 Thread Ben Finney
Ralf Schoenian writes: > yes, the following evaluates to False: > empty String: '' > empty list: [] > empty tuple: () > empty dict: {} > 0, None > and False of course More precisely: All the above evaluate as Boolean false. But only one of them evaluates to False: the object bound to the name ‘F

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread andrew cooke
> Just a correction: according to the doc, NotImplemented is not an > error, but a returned value. curious, so it is. i wonder why there is both a special return value (NotIMplemented) and a related exception (NotImplementedError). seems very odd to have a value... andrew -- http://mail.python

Re: is python Object oriented??

2009-01-31 Thread Steve Holden
MC wrote: > Re > >> ‘builtin’ is not a class. > > I think "object" ; not only "class" > And "builtin" is an object. > You can think what you like, but there is a fundamental difference between methods of a class and functions of a module. Until you appreciate that you will likely make mistakes.

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 9:59 am, Martin wrote: > There's tigris.org, savannah (savannah.gnu.org, nongnu.org), > launchpad. All of them are fine to some extent, you might want to read > up on PyMotW about how Doug Hellmann decided where to host his stuff. all i can find is that he is writing his own! http://bl

Re: nth root

2009-01-31 Thread Steve Holden
Mark Dickinson wrote: > On Jan 31, 5:43 am, "Tim Roberts" wrote: >> 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 qui

Re: Empty string is False right?

2009-01-31 Thread D'Arcy J.M. Cain
On Sat, 31 Jan 2009 12:16:19 + AJ Ostergaard wrote: > >>> '' and True > '' > > Surely that should be False?!? Why? The first value evaluates to False in a boolean context and thus is returned in the above statement due to short circuit evaluation but is not itself False. You wouldn't expe

Re: Empty string is False right?

2009-01-31 Thread Steve Holden
AJ Ostergaard wrote: > I'm not suggesting it's not operating as advertised - I'm suggesting the > 'advertising' is slightly sguiffy if you catch my drift. I guess it's > just me that finds it slightly counter intuitive. Surely intuitively the > expression is "and" and therefore should always return

Re: glob.fnmatch (was "search speed")

2009-01-31 Thread Tim Chase
rdmur...@bitdance.com wrote: 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

Re: Where to host a (Python) project?

2009-01-31 Thread Martin
2009/1/31 andrew cooke : > On Jan 31, 9:59 am, Martin wrote: >> There's tigris.org, savannah (savannah.gnu.org, nongnu.org), >> launchpad. All of them are fine to some extent, you might want to read >> up on PyMotW about how Doug Hellmann decided where to host his stuff. > > all i can find is that

Re: py2exe + SQLite problem

2009-01-31 Thread Armin
Gabriel Genellina wrote: En Fri, 30 Jan 2009 09:50:08 -0200, Armin escribió: Right at the end: "To install data files directly in the target directory, an empty string should be given as the directory." setup(..., data_files=[ ('', ['list/of/file/names', 'perhaps/includi

Re: nth root

2009-01-31 Thread Mark Dickinson
On Jan 31, 1:23 pm, Steve Holden wrote: > [Mark] > > power operation.  The integer -> float conversion is probably quite > > significant, timewise. > > I bow to your superior intuition! Here's another timing that shows the significance of the int -> float conversion: (non-debug build of the trunk

Re: nth root

2009-01-31 Thread Mark Dickinson
On Jan 31, 1:23 pm, Steve Holden wrote: > Much more significant points, given the limited precision of the doubles > Python will be using. Could gmpy do this better, I wonder? Almost certainly, if exact results are wanted! At least, GMP has an mpz_root function; I don't know offhand whether gmpy

Re: Where to host a (Python) project?

2009-01-31 Thread Michele Simionato
On Jan 31, 12:46 pm, andrew cooke wrote: > Any recommendations? Google Code seems fine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Empty string is False right?

2009-01-31 Thread Grant Edwards
On 2009-01-31, Vlastimil Brom wrote: > 2009/1/31 AJ Ostergaard : >> Hi Ralf, >> >> Thanks for that but why: >> > '' and True >> '' >> >> Surely that should be False?!? >> >> Regards, >> AJ >> >> > see the docs: > http://docs.python.org/reference/expressions.html#boolean-operations > > "The exp

Re: Where to host a (Python) project?

2009-01-31 Thread eliben
andrew cooke wrote: > Hi, > > I have a new project, that I just released in beta (http:// > www.acooke.org/lepl - a recursive decent parser with full > backtracking). At the moment I am using pypi and setuptools for > distribution (it's a pure python package) and I am happy with hosting > static

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 11:22 am, eliben wrote: > code.google.com provides all of these in a free and convenient manner. > Recommended. unfortunately google don't seem that reliable ;o) (have you tried a google search today?) -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread Christian Heimes
andrew cooke schrieb: >> Just a correction: according to the doc, NotImplemented is not an >> error, but a returned value. > > curious, so it is. i wonder why there is both a special return value > (NotIMplemented) and a related exception (NotImplementedError). seems > very odd to have a value..

Re: py2exe + SQLite problem

2009-01-31 Thread Thomas Heller
Armin schrieb: > As posted before ... set's my script (python 2.3): > > from distutils.core import setup > import py2exe > > setup(windows=['dpconf.py'], > data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]] > ) > > When I create the distribution I got the following err msg: > > *** c

Re: py2exe + SQLite problem

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 11:51:16 -0200, Armin escribió: Gabriel Genellina wrote: En Fri, 30 Jan 2009 09:50:08 -0200, Armin escribió: Right at the end: "To install data files directly in the target directory, an empty string should be given as the directory." setup(..., data_files=[

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread Gabriel Genellina
En Sat, 31 Jan 2009 11:03:13 -0200, andrew cooke escribió: Just a correction: according to the doc, NotImplemented is not an error, but a returned value. curious, so it is. i wonder why there is both a special return value (NotIMplemented) and a related exception (NotImplementedError).

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-31 Thread Aahz
In article <7xr62ufv1c@ruckus.brouhaha.com>, Paul Rubin wrote: >a...@pythoncraft.com (Aahz) writes: >> >> CPython's "primitive" storage management has a lot to do with the >> simplicity of interfacing CPython with external libraries. Any solution >> that propose

Re: Tkinter w.pack()?

2009-01-31 Thread W. eWatson
Steve Holden wrote: W. eWatson wrote: r wrote: On Jan 28, 10:12 pm, "W. eWatson" wrote: Where in the world is a description of pack() for Tkinter widgets? Is it some sort of general method for all widgets? I'm looking in a few docs that use it without ever saying where it is described. For on

Re: Tkinter w.pack()?

2009-01-31 Thread W. eWatson
Gabriel Genellina wrote: En Thu, 29 Jan 2009 14:55:13 -0200, W. eWatson escribió: Gabriel Genellina wrote: En Thu, 29 Jan 2009 02:57:04 -0200, W. eWatson escribió: The word pack doesn't exist on the NMT pdf. Maybe there's a newer one? There is a PDF version of "An Introduction to Tkinter

Re: glob.fnmatch (was "search speed")

2009-01-31 Thread rdmurray
Quoth Tim Chase : > rdmur...@bitdance.com wrote: > > What you want is: > > > > from fnmatch import fnmatch > > Oh, that's head-smackingly obvious now...thanks! > > My thought process usually goes something like > > """ > I want to do some file-name globbing > > there's a glob module that l

Re: Empty string is False right?

2009-01-31 Thread Diez B. Roggisch
AJ Ostergaard schrieb: Hi Ralf, Thanks for that but why: >>> '' and True '' Surely that should be False?!? No. Please read the section in the language reference about the and/or operators. "and" will return the first false value, or the right side. Thus '' and True -> '' True and '' ->

fastest way to detect a user type

2009-01-31 Thread Robin Becker
Whilst considering a port of old code to python 3 I see that in several places we are using type comparisons to control processing of user instances (as opposed to instances of built in types eg float, int, str) I find that the obvious alternatives are not as fast as the current code; func0 be

Re: nth root

2009-01-31 Thread Dan Goodman
Mark Dickinson wrote: I'd also be a bit worried about accuracy. Is it important to you that the integer part of the result is *exactly* right, or is it okay if (n**13)**(1./13) sometimes comes out as slightly less than n, or if (n**13-1)**(1./13) sometimes comes out as n? I don't think accura

Re: nth root

2009-01-31 Thread Mensanator
On Jan 31, 8:05 am, Mark Dickinson wrote: > On Jan 31, 1:23 pm, Steve Holden wrote: > > > Much more significant points, given the limited precision of the doubles > > Python will be using. Could gmpy do this better, I wonder? > > Almost certainly, if exact results are wanted!  At least, GMP has >

Re: Empty string is False right?

2009-01-31 Thread Stephen Hansen
On Sat, Jan 31, 2009 at 4:36 AM, AJ Ostergaard wrote:I'm not suggesting it's not operating as advertised - I'm suggesting the 'advertising' is slightly sguiffy if you catch my drift. I guess it's just me that finds it slightly counter intuitive. Surely intuitively the _expression_ is "and" and the

Re: Where to host a (Python) project?

2009-01-31 Thread ajaksu
On Jan 31, 1:03 pm, andrew cooke wrote: > On Jan 31, 11:22 am, eliben wrote: > > > code.google.com provides all of these in a free and convenient manner. > > Recommended. > > unfortunately google don't seem that reliable ;o)  (have you tried a > google search today?) You can mirror at LP, bitbuc

Re: is python Object oriented??

2009-01-31 Thread thmpsn . m . k
On Jan 30, 12:15 am, Chris Rebert wrote: > - Python supports encapsulation. Prefixing an attribute/method with an > underscore indicates that other programmers should treat it as > 'private'. However, unlike B&D languages, Python itself does nothing > to enforce this privacy, leaving it instead to

Python Doc 2.6 vs 2.5--A Matter of Format?

2009-01-31 Thread W. eWatson
I see for 2.5 and for 2.6. I'm guessing these two pages differ somewhat in formats simply because someone decided to do so, and not that I'm in the wrong place for each of the two versions, correct? For example, somewhere down in the 2.5

Re: nth root

2009-01-31 Thread Mensanator
On Jan 31, 10:53 am, Mensanator wrote: > On Jan 31, 8:05 am, Mark Dickinson wrote: > > > On Jan 31, 1:23 pm, Steve Holden wrote: > > > > Much more significant points, given the limited precision of the doubles > > > Python will be using. Could gmpy do this better, I wonder? > > > Almost certainl

Re: is python Object oriented??

2009-01-31 Thread Stephen Hansen
On Sat, Jan 31, 2009 at 9:08 AM, wrote:On Jan 30, 12:15 am, Chris Rebert wrote: > - Python supports encapsulation. Prefixing an attribute/method with an > underscore indicates that other programmers should treat it as > 'private'. However, unlike B&D languages, Python itsel

Re: nth root

2009-01-31 Thread Mark Dickinson
On Jan 31, 4:48 pm, Dan Goodman wrote: > I don't think accuracy is too big a problem here actually (at least for > 13th roots). I just tested it with several hundred thousand random 100 > digit numbers and it never made a mistake. Well, random numbers is one thing. But how about the following:

Re: persistent TCP connection in python using socketserver

2009-01-31 Thread markobrien85
On Jan 30, 5:54 am, Jean-Paul Calderone wrote: > On Thu, 29 Jan 2009 08:38:43 -0800 (PST), markobrie...@gmail.com wrote: > >G'day > > >I'm currentlyusingsocketserverto build a simple XMLSocket (an XML > >based protocol used for communication between flash and the outside > >world) server. I've got

Re: Python Doc 2.6 vs 2.5--A Matter of Format?

2009-01-31 Thread Stephen Hansen
On Sat, Jan 31, 2009 at 9:14 AM, W. eWatson wrote:I see for 2.5 and for 2.6. I'm guessing these two pages differ somewhat in formats simply because someone decided to do so, and not that I'm in the wrong place for each of the two versions,

Re: nth root

2009-01-31 Thread Dan Goodman
Mark Dickinson wrote: Well, random numbers is one thing. But how about the following: n = 12345**13 n 154662214940914131102165197707101295849230845947265625L int(n ** (1./13)) # should be 12345; okay 12345 int((n-1) ** (1./13)) # should be 12344; oops! 12345 Good point! Oops indeed. :

Re: is python Object oriented??

2009-01-31 Thread thmpsn . m . k
On Jan 30, 2:32 pm, Michael Torrie wrote: > 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

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread Scott David Daniels
Csaba Hoch wrote: if I write the following: >>> 1+1 2 it seems to be exactly equivalent to this: >>> (1).__add__(1) 2 However, if I write invalid code and try to add a list to an int, the errors will be different: As has been explained, binary operators are trickier than the a

Re: Empty string is False right?

2009-01-31 Thread Scott David Daniels
Steve Holden wrote: AJ Ostergaard wrote: I'm not suggesting it's not operating as advertised - I'm suggesting the 'advertising' is slightly sguiffy if you catch my drift. I guess it's just me that finds it slightly counter intuitive. Surely intuitively the expression is "and" and therefore shoul

Re: Python Doc 2.6 vs 2.5--A Matter of Format?

2009-01-31 Thread Martin v. Löwis
> I see for 2.5 and > for 2.6. I'm guessing these two pages differ > somewhat in formats simply because someone decided to do so, and not > that I'm in the wrong place for each of the two versions, correct? Correct. The documentation forma

Re: nth root

2009-01-31 Thread ajaksu
On Jan 31, 12:03 pm, Mark Dickinson wrote: [...] > t1 = timeit.Timer("x = n**power", "n = > 4021503534212915433093809093996098953996019232; power = 1./13") > t2 = timeit.Timer("x = n**power", "n = > 4021503534212915433093809093996098953996019232.; power = 1./13") And by using a float literal in

Re: search speed

2009-01-31 Thread Tim Rowe
2009/1/30 Scott David Daniels : > Be careful with your assertion that a regex is faster, it is certainly > not always true. I was careful *not* to assert that a regex would be faster, merely that it was *likely* to be in this case. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-

Re: Python-list Digest, Vol 64, Issue 697

2009-01-31 Thread AJ Ostergaard
AJ Ostergaard wrote: I'm not suggesting it's not operating as advertised - I'm suggesting the 'advertising' is slightly sguiffy if you catch my drift. I guess it's just me that finds it slightly counter intuitive. Surely intuitively the expression is "and" and therefore should always return

Searching a file for multiple strings

2009-01-31 Thread gotbyrd
Hello, I'm fairly new with python and am trying to build a fairly simple search script. Ultimately, I'm wanting to search a directory of files for multiple user inputted keywords. I've already written a script that can search for a single string through multiple files, now I just need to adapt i

Re: len()

2009-01-31 Thread Andreas Waldenburger
On Sat, 31 Jan 2009 13:27:02 -0500 Pat wrote: > Tobiah wrote: > > Just out of curiosity, why was len() made to > > be it's own function? I often find myself > > typing things like my_list.len before I > > catch myself. > > > > Thanks, > > > > Toby > > I'm surprised that no one responded to th

Import Replacement

2009-01-31 Thread James Pruitt
Imagine there are two files horse.py and buffalo.py. horse.py is imported by another file rider.py. Is it possible to make it so that under certain circumstances possibly based on an environment variable or something similar that when rider.py imports horse.py, it actually imports buffalo.py sort o

Import Replacement

2009-01-31 Thread James Pruitt
Imagine there are two files horse.py and buffalo.py. horse.py is imported by another file rider.py. Is it possible to make it so that under certain circumstances possibly based on an environment variable or something similar that when rider.py imports horse.py, it actually imports buffalo.py sort o

Re: is python Object oriented??

2009-01-31 Thread Andreas Waldenburger
On Sat, 31 Jan 2009 09:11:03 +0100 Laszlo Nagy wrote: > Python is not a pure object oriented language, because it has other > programming tools, for example functions. I'm not sure about the first part of the sentence, but Python's functions are objects. Check it in the interpreter: attributes,

Re: Searching a file for multiple strings

2009-01-31 Thread Tim Chase
I'm fairly new with python and am trying to build a fairly simple search script. Ultimately, I'm wanting to search a directory of files for multiple user inputted keywords. I've already written a script that can search for a single string through multiple files, now I just need to adapt it to mu

Re: Where to host a (Python) project?

2009-01-31 Thread Giampaolo Rodola'
On 31 Gen, 12:46, andrew cooke wrote: > Hi, > > I have a new project, that I just released in beta > (http://www.acooke.org/lepl- a recursive decent parser with full > backtracking).  At the moment I am using pypi and setuptools for > distribution (it's a pure python package) and I am happy with

Re: Searching a file for multiple strings (PS)

2009-01-31 Thread Tim Chase
I'm fairly new with python and am trying to build a fairly simple search script. Ultimately, I'm wanting to search a directory of files for multiple user inputted keywords. I've already written a script that can search for a single string through multiple files, now I just need to adapt it to mu

Re: nth root

2009-01-31 Thread Mark Dickinson
On Jan 31, 7:04 pm, ajaksu wrote: > also a great way make some innocent bystander waste his eyesight > trying to figure out the magic trick :D Oh, come on! At least I put the two lines next to each other! :-) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: SimpleXMLRPCServer question

2009-01-31 Thread flagg
On Jan 30, 8:12 pm, rdmur...@bitdance.com wrote: > 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 re

Re: Where to host a (Python) project?

2009-01-31 Thread Andrey Demidov
I use Google Code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Import Replacement

2009-01-31 Thread Gary Herron
James Pruitt wrote: > Imagine there are two files horse.py and buffalo.py. horse.py is > imported by another file rider.py. Is it possible to make it so that > under certain circumstances possibly based on an environment variable > or something similar that when rider.py imports horse.py, it actual

Re: is python Object oriented??

2009-01-31 Thread Christian Heimes
thmpsn@gmail.com schrieb: > But it's only a faking, and things such as inheritance and > polymorphism are implemented clumsily (actually I'm not even sure > about polymorphism). And of course, there are still no private > members. Do you honestly believe that C++'s private members are really p

help me python

2009-01-31 Thread aolsuppo
C:\Python26>vnc.py Traceback (most recent call last): File "C:\Python26\vnc.py", line 4, in import PyD3DES ImportError: DLL load failed: The specified module could not be found. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 4:50 pm, "Giampaolo Rodola'" wrote: > Google Code. > > --- Giampaolohttp://code.google.com/p/pyftpdlib thanks - that's a nice example. i'm a bit concerned about the whole google corporation thing, but reading through the ideological check- sheet at savannah convinced me i wasn't worth

Re: is python Object oriented??

2009-01-31 Thread Michael Torrie
thmpsn@gmail.com wrote >> This allows people to meddle with internals, at their own risk, >> if it ends up being absolutely necessary. > > If it ends up being necessary, the class's design is flawed. (Though > in this case, the flaw is easily solved by simply providing a getter.) No the class

Re: is python Object oriented??

2009-01-31 Thread Michael Torrie
thmpsn@gmail.com wrote: >> To be clear, python does not force you to lay out your code according to >> some strict object-oriented paradigm. But Python itself is still purely >> object-oriented, as is your script when parsed. > > But it's only a faking, and things such as inheritance and > pol

Re: is python Object oriented??

2009-01-31 Thread Michael Torrie
Steve Holden wrote: > You can think what you like, but there is a fundamental difference > between methods of a class and functions of a module. Until you > appreciate that you will likely make mistakes. Don't worry, though, we > all learn from our mistakes. And this fundamental difference is? >F

Re: SimpleXMLRPCServer question

2009-01-31 Thread rdmurray
Quoth flagg : > Let me see if i can elaborate on the requirements. I have 20+ > different zone files. I want the xmlrpc server to be able to > determine what zone file to open by looking at the incoming xml > request. For example one of the functions I have now is to show a DNS > record (I am us

Re: Tkinter w.pack()?

2009-01-31 Thread Steve Holden
W. eWatson wrote: > Steve Holden wrote: >> W. eWatson wrote: >>> r wrote: On Jan 28, 10:12 pm, "W. eWatson" wrote: > Where in the world is a description of pack() for Tkinter widgets? > Is it > some sort of general method for all widgets? I'm looking in a few > docs that >

Re: is python Object oriented??

2009-01-31 Thread thmpsn . m . k
On Jan 31, 2:27 pm, Christian Heimes wrote: > thmpsn@gmail.com schrieb: > > > But it's only a faking, and things such as inheritance and > > polymorphism are implemented clumsily (actually I'm not even sure > > about polymorphism). And of course, there are still no private > > members. > > Do

Re: persistent TCP connection in python using socketserver

2009-01-31 Thread Stephen Hansen
Cheers mate I had a look into twisted but was put off by the FAQ stating 1.0+ modules may or may not be stable, and only the 'core' is. I don't wanna be messing around with a potentially buggy server, so im gonna roll my own using the sockets module. You didn't read that FAQ right: its addres

Re: nth root

2009-01-31 Thread Robert Kern
On 2009-01-30 22:00, Tim Roberts wrote: 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? No, but Google would help. -- Robert Kern "I have come to believe that the whol

Re: nth root

2009-01-31 Thread Tim Roberts
"Tim Roberts" wrote: > >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 > >

Re: help me python

2009-01-31 Thread andrew cooke
On Jan 31, 5:36 pm, aolsu...@gmail.com wrote: > C:\Python26>vnc.py > Traceback (most recent call last): >   File "C:\Python26\vnc.py", line 4, in >     import PyD3DES > ImportError: DLL load failed: The specified module could not be found. i'm surprised no-one has replied here. what is happening

Newbie Question: Can't multiply sequence by non-int of type 'str'

2009-01-31 Thread Paulo Repreza
Hi, I'm just learning the very basics of python and I ran into this problem in version 3.0/3000: >>>x = input("x: ") x: 36 >>> y = input("y: ") y: 42 >>> print (x*y) Traceback (most recent call last): File "", line 1, in print (x*y) TypeError: can't multiply sequence by non-int of type 'st

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

2009-01-31 Thread r
On Jan 30, 4:36 pm, Steve Holden wrote: [snip] > It's mostly a matter of teaching by example. I'd like to think I usually > set a good example, but I've certainly been known to get crabby from time > to time Steve you are defiantly the better of two evils around here :D -- http://mail.python.org/

  1   2   >