Re: Character Sequence Generation

2005-09-22 Thread [EMAIL PROTECTED]
JKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xcd\xce... lowercase = 'abcdefghijklmnopqrstuvwxyz\x83\x9a\x9c\x9e\xaa\xb5\xba\xd... octdigits = '01234567' printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU... punctuation = '!"#$%&\'(

Re: subprocess.Popen and replacing the shell pipe line

2005-09-23 Thread [EMAIL PROTECTED]
by the way, you're re-inventing the wheel somewhat, check out the stdlib pipes module (http://docs.python.org/lib/module-pipes.html) -- http://mail.python.org/mailman/listinfo/python-list

Re: File processing

2005-09-23 Thread [EMAIL PROTECTED]
The ConfigParser class is designed for this task, see http://docs.python.org/lib/module-ConfigParser.html -- http://mail.python.org/mailman/listinfo/python-list

Re: batch mkdir using a file list

2005-09-23 Thread [EMAIL PROTECTED]
Jeremy Jones wrote: > DataSmash wrote: > > >Hello, > >I think I've tried everything now and can't figure out how to do it. > >I want to read in a text list from the current directory, > >and for each line in the list, make a system directory for that name. > > > >My text file would look something

HTML to LaTeX RE pattern and sub

2005-09-23 Thread [EMAIL PROTECTED]
Hi, trying to make a small script which would translate wiki file into LaTeX and when trying to translate possible HTML elements into LaTeX I did this: def latexEnvironments(matchobj): print >>sys.stderr,str(matchobj.groups()) inStr = matchobj.group(1) translDict = {'dl': ('\\begin{de

Re: Help installing Python 2.3 on Win2K

2005-09-23 Thread [EMAIL PROTECTED]
D.S. Hein wrote: > I have installed python 2.3 on my Windows 2K laptop and I can run python > from the command prompt. > > I have tried various ways to set PYTHONPATH with the various directories > where I have python programs (i.e. xx.py) but no matter how I set > PYTHONPATH I keep getting a

RE + UTF-8

2005-09-24 Thread [EMAIL PROTECTED]
_Chel";>http://en.wikipedia.org/wiki/Petr_Chelcický Petr Chelcický's] The RE genericwiki uses for parsing this: # WikiName pattern used in your wiki wikinamepattern = r'\b(([A-Z]\w+){2,})\b' # original mailurlpattern = r'mailto\:[\"[EMAIL PROTECTED]

py2exe and OpenGL problem

2005-09-25 Thread [EMAIL PROTECTED]
I am using the new py2exe and python 24. When I run my setup.py, the dist seems to generate just fine. However run I run the resulting exe, I get an error: IOError: [Errno 2] No such file or directory 'c:\\app\\dist\\library.zip\\OpenGL\\version' Now I've tried the recommended route with older py

Re: Alternatives to Stackless Python?

2005-09-25 Thread [EMAIL PROTECTED]
Honestly I am not knowledgeable about either option but mainly I was specifically targetting my feature set towards the things that a higher level game engine would need such as the one described here: http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/ Which

Re: good exercises for Beginner

2005-09-26 Thread [EMAIL PROTECTED]
try this... http://www.awaretek.com/tutorials.html Cheers, pujo -- http://mail.python.org/mailman/listinfo/python-list

Python batching on XP

2005-09-27 Thread [EMAIL PROTECTED]
Hi ! I want to write a program that backup some databases in the night. Pseudo like this: try: if cmd('net stop dbservice'): s=c://backup'+str(time.time())+'.zip' if cmd('zipit c:\\database '+s): if cmd('map drive backupdrive\\c$ y -user BACKUP -pwd SECRET'): if cmd('cop

Re: Python batching on XP

2005-09-28 Thread [EMAIL PROTECTED]
errfn,"r") try: s2=f.read() finally: f.close() s="\n".join([s1,s2]).strip() return (r,s) Anyone have a better idea ? Thanks for it: dd Larry Bates wrote: >You should take a look at the subprocess module >http://www.python.org/dev/doc/deve

Re: Human readable number formatting

2005-09-28 Thread [EMAIL PROTECTED]
MrJean1 wrote: > No, I didn't. See the references at the bottom. > > /Jean Brouwers So when I say "I'm sorta busy" it means I'm REALLY busy. -- http://mail.python.org/mailman/listinfo/python-list

How to increment a date, and how to convert it ?

2005-09-29 Thread [EMAIL PROTECTED]
Hi ! 1. I have a code. I want to convert from wx.DatePickerCtrl.Value to mx.DateTime. But I don't know, how to do it simply. 2. I need to increment this date by 6 days. How to do it ? (I search for a simple way, like Delphi-s d2:=d1+6) The code section is: from mx import DateTime as m

getattr

2005-09-30 Thread [EMAIL PROTECTED]
This question is regarding the __getattr__ function defined for every object. Consider the following example Assume that foo is an instance of class Foo, and the following are references to foo's field "bar" which is an instance of class Bar a) foo.bar b) foo.bar.spam - spam is a member of "bar"

Re: MS Word mail merge automation

2005-09-30 Thread [EMAIL PROTECTED]
Steve M wrote: > I'm trying to do invoke the mail merge functionality of MS Word from a > Python script. The situation is that I have a template Word document, > and a record that I've generated in Python, and I want to output a new > Word .doc file with the template filled in with the record I've

Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-09-30 Thread [EMAIL PROTECTED]
Steven D'Aprano wrote: > On Fri, 30 Sep 2005 18:02:14 -0400, Sherm Pendley wrote: > > > [EMAIL PROTECTED] writes: > > > >> I wonder if his postings are related to the phases of the moon? It > >> might explain a lot. > > > > Yes, it would. Note

Re: A Moronicity of Guido van Rossum

2005-09-30 Thread [EMAIL PROTECTED]
I have an excellent idea. Create your own programming language and do whatever you want with it. Until then, I'm thinking that Guido can do whatever he wants with his. But I'm guessing that your programming skills will be in the same place as your greatness - in your own head. -- http://mail.pyth

Re: Printing and prompting adds a mysterious extra space

2005-10-01 Thread [EMAIL PROTECTED]
Christoph Haas wrote: > Evening... > > I'm writing a simple interactive program to maintain a database. > The goal was to print "> " at the beginning of the line, wait for > user input and then deal with it. Minimal test program: > > import sys; print ">", ; print sys.stdin.readline() > > However

Re: how to send a SIGINT to a Python process?

2005-10-02 Thread [EMAIL PROTECTED]
AFAIK there isn't. You could browse through this http://starship.python.net/crew/tmick/ to get an idea on how to kill on both platforms. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for search engine development

2005-10-02 Thread [EMAIL PROTECTED]
Well, Google applies some Python in their implementation, see http://www-db.stanford.edu/~backrub/google.html -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-02 Thread [EMAIL PROTECTED]
The easiest way to avoid this problem (besides watching for NameError exceptions) is to use an editor that has automatic name completion. Eric3 is a good example. So, even though in theory it could be an issue, I rarely run into this in practice. -Don -- http://mail.python.org/mailman/listinfo/

Re: forum

2005-10-02 Thread [EMAIL PROTECTED]
is there any forum writen by python like vbb...phped -- http://mail.python.org/mailman/listinfo/python-list

Py2Exe + kinterbasdb

2005-10-03 Thread [EMAIL PROTECTED]
Hi ! I compile an application (that working good in native python) to exe with py2exe. In native mode (python.exe ReportApp.py) it is working, the reports are created good. But when I try to create a report from the compiled exe, it is show an error: Traceback (most recent call last): File "

Re: Idle

2005-10-04 Thread [EMAIL PROTECTED]
If you are compiling python and you want to build idle/tkinter, you need to have the development packages for tcl and tk. The python build scripts will only build tkinter should they find the libraries (libtk8.4.so and libtcl8.4.so) and the header files (tk.h and tcl.h). If you don't have the devel

Re: While and If messing up my program?

2005-10-05 Thread [EMAIL PROTECTED]
hi, to get howmany element list appear you can code: ttllst=[4,3,45,3] for x in ttllst: print x, ttllst.count(x) pass to get non duplicate element list you can code: ttllst=[4,3,45,3] print list(set(ttllst)) Cheers, pujo -- http://mail.python.org/mailman/listinfo/p

Quick help needed: how to format an integer ?

2005-10-05 Thread [EMAIL PROTECTED]
Hi ! I need to convert some integer values. "1622" ->"1 622" or "10001234" -> ""10.001.234"" So I need thousand separators. Can anyone helps me with a simply solution (like %xxx) ? Thanx for it: dd Ps: Now I use this proc: def toths(i): s=str(i) l=[] ls=len(s) for i in rang

Can Python replace TCL/Expect

2005-10-05 Thread [EMAIL PROTECTED]
Hi I'm learning Python. I don't know whether Python can do something like Expect can do. If yes, please show me how to do it. I want to do something automatically: open connection to a ftp server, get the welcome message on the screen (not in the packet). I can do it easily with Expect but I still

Re: non descriptive error

2005-10-07 Thread [EMAIL PROTECTED]
You should tell us more about DutyShift.py, without the code it is very difficult for other people to guess what's going on. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
For this, you can also define the __eq__ method, which will be preferred to __cmp__ for equallity tests while still using __cmp__ for searching / comparisons. -- http://mail.python.org/mailman/listinfo/python-list

GUI on Macintosh

2005-10-07 Thread [EMAIL PROTECTED]
I am using Python 2.3.3 on an Mac OS9 system. I am looking for a build of Python 2.3.3+ with a built in GUI, since Tk is missing. One day I hope to upgrade to a new Mac with OSX on it, so a GUI that is available on OS9 and OSX is preferable. I don't want to write my GUI code from scratch if I ev

Re: noob question Letters in words?

2005-10-07 Thread [EMAIL PROTECTED]
Ivan Shevanski wrote: > Alright heres another noob question for everyone. Alright, say I have a > menu like this. > > print "1. . .Start" > print "2. . .End" > choice1 = raw_input("> ") > > and then I had this to determine what option. > > > if choice1 in ('1', 'Start', 'start'): > #do first

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread [EMAIL PROTECTED]
Luis M. Gonzalez wrote: > Grant Edwards ha escrito: > > While we're off this topic again topic, I was watching a BBC > > series "Space Race" the other night. The British actors did a > > passable job with the American accents in the scenes at Fort > > Bliss in Texas, but the writers wrote British

Re: Contest snub?

2005-10-08 Thread [EMAIL PROTECTED]
Will McGugan wrote: > [EMAIL PROTECTED] wrote: > > Notice anything strange here? The Python entry seems to have edged the PHP > > entries, but is not declared the victor. Source is missing as well (the > > archive > > is empty.) > > > > http://www.

"import socket" error

2005-10-09 Thread [EMAIL PROTECTED]
Hi, I am following this tutorial https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=dw-linux-pysocks&S_TACT=105AGX59&S_CMP=GR&ca=dgr-lnxw07PythonSockets ( free reg. req. ) The article told me to do this: [camus]$ python Python 2.4 (#1, Feb 20 2005, 11:25:45) [GCC 3.2.2 20030222 (Re

The missing ingredient?

2005-10-09 Thread [EMAIL PROTECTED]
Python is a great programming language, and it seems there was a sense of fun in developing it -- as far as I can ascertain, it wasn't exactly brought to life to comply with Government tax regulations; or to assist a consigliere with covering up ghastly mob crimes ala "Godfather". Though there is

Re: Comparing lists

2005-10-10 Thread [EMAIL PROTECTED]
try to use set. L1 = [1,1,2,3,4] L2 = [1,3, 99] A = set(L1) B = set(L2) X = A-B print X Y = B-A print Y Z = A | B print Z Cheers, pujo -- http://mail.python.org/mailman/listinfo/python-list

Let My Terminal Go

2005-10-10 Thread [EMAIL PROTECTED]
Hello, A user of my application points me to a behavior in gVim, the text editor, that I would like to implement in my application. When gVim is launched from a shell terminal, it completely frees the terminal. You can continue to use the terminal for whatever purpose you wish, including closing

Re: datetime and daylight savings problem

2005-10-11 Thread [EMAIL PROTECTED]
When working with timezones datetime objects are represented in the tzinfo object you supply, eg. when you define these classes (and run them on a system set to Paris time): from datetime import tzinfo, timedelta, datetime import time class UTC(tzinfo): """UTC timezone""" def utcoffset(s

Re: Parser suggestion

2005-10-11 Thread [EMAIL PROTECTED]
Take a look at PLY. There is an example lexer in the download for parsing fortran. -- http://mail.python.org/mailman/listinfo/python-list

Bad magic no. in python zipfile

2005-10-12 Thread [EMAIL PROTECTED]
I've been experimenting with the python zipfile module, and have run into a snag. I'm able to create a new zipfile with the module's ZipFile class and add files to it. After closing the file, I'm able to view the contents of it with WinZip. I can also confirm that it is a python zip file by usin

how to make this code faster

2005-10-12 Thread [EMAIL PROTECTED]
def f(x,y): return math.sin(x*y) + 8 * x I have code like this: def main(): n = 2000 a = zeros((n,n), Float) xcoor = arange(0,1,1/float(n)) ycoor = arange(0,1,1/float(n)) for i in range(n): for j in range(n): a[i,j] = f(xcoor[i], ycoor[j]) # f(x,y) =

Re: how to make this code faster

2005-10-13 Thread [EMAIL PROTECTED]
hello, I found that scipy only works with python 2.3 or? I don't know if the logic is correct: 1. loop inside loop uses a lot of resources 2. Numeric or Numpy can make program faster 3. It use kind of Array/Matrix analysis style 4. We have to change our algorithms so that Numeric or Numpy can hel

Re: Bad magic no. in python zipfile

2005-10-13 Thread [EMAIL PROTECTED]
okay, I've figured out the problem - the zip file was being mangled by a file transfer. I was fetching a remote python-generated zip file in 8k chunks, and then writing those chunks to a file. At first I was using an array to store the data in, and had the 'bad magic number' problem. This may ha

Re: UI toolkits for Python

2005-10-14 Thread [EMAIL PROTECTED]
I find wxPython to pro fill my GUI needs from python in a pretty good way. To show off it's capabilities - I am building a GUI editor and it currently converts from windows forms (visual studio c# forms) to wxPython code. When I started programming this editor I thought I'd have major incompatibili

Re: UI toolkits for Python

2005-10-14 Thread [EMAIL PROTECTED]
sure it is, but since this is a Python list, you'd also need PyQt to go along with it, and there's no version of PyQt yet compatible with Qt4. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with properties

2005-10-14 Thread [EMAIL PROTECTED]
If you change it to this it works. You should provide a get and a set function for a property. class Task: def __init__(self, value): self._command = value def setCommand(self, value): self._command = value def getCommand(self): return self._command command=property(

Re: Problems with properties

2005-10-14 Thread [EMAIL PROTECTED]
If you change it to this it works. You should provide a get and a set function for a property. class Task: def __init__(self, value): self._command = value def setCommand(self, value): self._command = value def getCommand(self): return self._command command=property(

Re: Python's garbage collection was Re: Python reliability

2005-10-14 Thread [EMAIL PROTECTED]
Paul Rubin wrote: > This correctly describes difficulties of using a copying GC in > CPython. Note that the Boehm GC is mark-and-sweep. As Alex mentions, > that usually means there's a pause every so often while the GC scans > the entire heap, touching all data both live and dead (maybe the Boehm

Good news and bad news!!

2005-10-14 Thread [EMAIL PROTECTED]
information 01189897601 [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-14 Thread [EMAIL PROTECTED]
Hm... What does this have to do with Perl? Why did you post this in comp.lang.perl.misc? -- http://mail.python.org/mailman/listinfo/python-list

Accessing Parallel Port in Python Error : Priviledged Instruction

2005-10-14 Thread [EMAIL PROTECTED]
Hello When I use Pyparallel to access the parallel port in WinXP with Python I get an error saying that this is a priviledged instruction Any clue ? Mike -- http://mail.python.org/mailman/listinfo/python-list

subtle side effect of generator/generator expression

2005-10-16 Thread [EMAIL PROTECTED]
Hi, I initially thought that generator/generator expression is cool(sort of like the lazy evaluation in Haskell) until I notice this side effect. >>>a=(x for x in range(2)) >>>list(a) [1,2] >>>list(a) [] Would this make generator/generator expression's usage pretty limited ? As when the program/

Re: subtle side effect of generator/generator expression

2005-10-16 Thread [EMAIL PROTECTED]
That is exactly what I meant, in fact. These IO thing are expected to have side effects so they are not subtle. Generator on the other hand, is sort of "clever iteratables". Now that I notice that, Of course I can be sure I would be careful. But what about the following situation : I import some

Re: tuple versus list

2005-10-16 Thread [EMAIL PROTECTED]
ht)], > [imgFullPath,(width, height)], > [imgFullPath,(width, height)], > ... > ] > > should i use (width,height) or [width,height]? > what advantage i get to use n-tuple instead of the generic list? > > Thanks. > > Xah > [EMAIL PROTECTED] > ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: subtle side effect of generator/generator expression

2005-10-16 Thread [EMAIL PROTECTED]
True. That is why I have now reverted back to use list whenever possible. As while list can also be modified(say in a multi-thread situation), at least if I don't do the update(coding policy, practice or whatever), they are sort of "guaranteed". I would only use generator as IO monad in Haskell, i

Re: subtle side effect of generator/generator expression

2005-10-16 Thread [EMAIL PROTECTED]
thanks. I was looking for scanl in itertools but can't find it so I implement my own then run into some subtle bugs which first made me think my scanl is the problem. Then notice my wrong perception about generator(and iterable in general, though the built-in iterables like list, dict don't seem to

Re: subtle side effect of generator/generator expression

2005-10-16 Thread [EMAIL PROTECTED]
> Are you saying that the bugs it causes aren't subtle? *wink* Exactly. Destructive generator problems are caught almost immediately. -- http://mail.python.org/mailman/listinfo/python-list

generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
Hi, I was reading this recipe and am wondering if there is a generic version of it floating around ? My list is a tuple (date, v1, v2, v3) and I would like it to sort on date. The documentation doesn't mention how the items are compared and the example only use integers. http://aspn.activestate.c

Re: generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
oops, sorry. I meant l1=[(date,v1,v2,v3), ...] l2=[ another set of tuples ] Thanks. so I have to concat the multiple lists first(all of them are sorted already) ? Alex Martelli wrote: > I'm not sure what "my list is a tuple" mean (list and tuple being > different types) nor what this has to do

Re: generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
million thanks. So the default compare funcion of heapq also do it like sort ? The size of the list is not very large but has the potential of being run many times(web apps). So I believe second one should be faster(from the app perspective) as it goes into the optimized code quickly without all t

Re: Vim IS a capable IDE [was Re: Vim capable IDE?]

2005-10-18 Thread [EMAIL PROTECTED]
Chris Lambacher wrote: > > * Usage tips/tooltips: Also something I found in PythonWin. During the > > writing of the method, a little tip box pops up advising me what the > > inputs are for a method or an instance construction for a class. Very > > nice, very productive. > VIm 7 may support that ou

Re: how best to split into singleton and sequence

2005-10-18 Thread [EMAIL PROTECTED]
what you wrote is the most readable to me: just asign the first 2 element to t, l respectively and forget about the rest. I assume that is what you want. I think perl may do it this way. A solution which I think looks uglier is : t, l = s.split('|')[:2] Randy Bush wrote: > >>> l = [] > >>> s =

Re: bug in os.system?

2005-10-18 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > OK, I give up. Why does workaround #2 work? Well, there was a time when the cmd prompt treated all spaces as delimiters, so >cd My Documents would fail. Nowadays you can do that successfully and even >cd My Documents\My Pictures works. In the old

Re: Upgrading 2.4.1 to 2.4.2

2005-10-18 Thread [EMAIL PROTECTED]
Not sure that is a good idea on a linux system. MS should be fine, but I actually tried that on linux. Didn't realize how much on a linux system depends on Python. Basically ended up doing a full re-install. I'll never do that again. -- http://mail.python.org/mailman/listinfo/python-list

Re: write a loopin one line; process file paths

2005-10-18 Thread [EMAIL PROTECTED]
x27;-s'. > temp=imgPaths[:] > imgPaths=[] > for myPath in temp: > p=myPath > (dirName, fileName) = os.path.split(myPath) > (fileBaseName, fileExtension)=os.path.splitext(fileName) > if(re.search(r'-s$',fileBaseName,re.U)): > p2=os.path.j

Re: write a loopin one line; process file paths

2005-10-18 Thread [EMAIL PROTECTED]
all in one line, is important in functional programing. > Perl supports it. In Mathematica, it's simply the form If[testExpr, > trueExpr, falseExpr]. In lisp, similar: (if testExpr trueExpr > falseExpr) ) > > is there a way to similate it? > > Xah > [EMAIL PROTECTED] >

Re: write a loopin one line; process file paths

2005-10-19 Thread [EMAIL PROTECTED]
hich is getting better and better in terms of real world module support(file system, network etc). > > (excuse me for lashing out) > > Xah > [EMAIL PROTECTED] > ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: write a loopin one line; process file paths

2005-10-19 Thread [EMAIL PROTECTED]
Xah Lee wrote: > This i'm not sure. Of the past couple of years i increasingly developed > a theory (probably well-known among proper experts), that the > difficulty of human feats of various forms, are primarily a perception > and familiarity thing. This may be getting off topic, but i wrote an >

Re: Controlling exception handling of logging module

2005-10-19 Thread [EMAIL PROTECTED]
make the second statement 'logging.info("%d %d", 1, 2)' or 'logging.info("%d %d %d", 1, 2, 3)', and all works. for every argument you want to log you need one format specifier -- http://mail.python.org/mailman/listinfo/python-list

Re: Python variables are bound to types when used?

2005-10-19 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > reset your brain: > > http://effbot.org/zone/python-objects.htm Neat link. Can you expand on this: > a type (returned by type(x)) ... > You cannot change the type. Especially what's going on here: >>> class a(object): ... pass ... >>> class b(a): ... pass ...

sqlstring -- a library to build a SELECT statement

2005-10-19 Thread [EMAIL PROTECTED]
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to start at the bottom. What seems to plague many ORM systems is the syntactic confusion and string-manipula

How can I call a subclass method from parent class ?

2005-10-19 Thread [EMAIL PROTECTED]
Hi, Suppose my class definition is like this : class A: name = "A" @classmethod def foo(cls): cls.__super.foo() cls.bar() @classmethod def bar(cls): print cls.name class B(A): name = "B" class C(B): name = "C" What I want is C.foo() prints

Re: sqlstring -- a library to build a SELECT statement

2005-10-19 Thread [EMAIL PROTECTED]
Jason Stitt wrote: > > I think some operator overloading, especially the obvious cases like > ==, is cleaner than using only functions because it lets you order > things normally. But some of the operator choices are non-intuitive. > Personally, I would make something like 'alias' a function or cl

Re: How can I call a subclass method from parent class ?

2005-10-20 Thread [EMAIL PROTECTED]
thanks, it works. Though I don't quite understand what super(cls,cls) returns, and it doesn't work if I do a super(cls,cls).foo(). But cls.__base__.foo() do the trick. thankfully, I don't have multiple inheritance. Jason Lai wrote: > If you use a newstyle class, e.g. class A(object), then you ca

Re: How can I call a subclass method from parent class ?

2005-10-20 Thread [EMAIL PROTECTED]
Thanks for the explanation but some how my code fail and since I don't need multiple inheritance for the moment, I would settle for the not so clean version. The documentation of super is not very clear to me too. As seen in my code, I am using classmethod which may cause some problem. Steve Hold

best way to replace first word in string?

2005-10-20 Thread [EMAIL PROTECTED]
I am looking for the best and efficient way to replace the first word in a str, like this: "aa to become" -> "/aa/ to become" I know I can use spilt and than join them but I can also use regular expressions and I sure there is a lot ways, but I need realy efficient one -- http://mail.python.org/m

Re: __getattr__, __setattr__

2005-10-20 Thread [EMAIL PROTECTED]
for new style classes __getattribute__ is defined, see eg. http://www.python.org/2.2.3/descrintro.html -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> The big operator question will be: how will "and" and "or" be > implemented? This is always a sticking point because of Python's > short-circuiting behaviors regarding them (the resultant bytecode will > include a JUMP). I'm using the Boolean | and & operators for logical groups, eg (a | b | (b

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> >> Using // for 'in' looks really weird, too. It's too bad you can't > >> overload Python's 'in' operator. (Can you? It seems to be hard-coded > >> to iterate through an iterable and look for the value, rather than > >> calling a private method like some other builtins do.) > >> > > > > // was a

Ruby on Rails Agile role

2005-10-20 Thread [EMAIL PROTECTED]
I am looking for 2 Software Engineers with a Java / Python / Ruby background to work for a rapidly growing start-up using Ruby on Rails in an Agile environment. The role is paying between £40 - £45k and is based in central London. Please send your details to grant @ connectionsrecruit.co.uk or

newbie question about SocketServer

2005-10-20 Thread [EMAIL PROTECTED]
Is it just me or do the server_close() methods do squat? I'm primarily working with a ThreadingTCPServer object and trying to create a simple server that can shut itself down. But even simplest cases don't seem to work. Admittedly I am trying it from within my handler class, but for some odd rea

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
Tom Anderson wrote: > On Thu, 20 Oct 2005, [EMAIL PROTECTED] wrote: > > > On this line of thought, what about the += operator? That might be more > > intuative than //. I could even use -= for not in. > > You're going to have to explain to me how using an assign

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> person ** ( > (person.type_id == 'customer') > & (person.id %= phone(phone.person_id))) > ) > Nevermind. This doesn't work because all of the X= operators in question are assignment operators, and therefore generate a Syntax Error if in a nested expression. I think I've settled on just doin

Re: Python vs Ruby

2005-10-20 Thread [EMAIL PROTECTED]
I don't think you really need to give to much time in weighting between python or Ruby. Both are fine. But Python has the obvious advantage that it has much more modules than Ruby so many things you don't need to implement if you have real work to do. I recommend you give haskell a shot if you are

Re: fun with lambdas

2005-10-20 Thread [EMAIL PROTECTED]
You are asking it to return a list of lambda, not its evaluated value. map(lambda x: f(x,0), [0,1,2]) works. [ f(o) for o in [0,1,2] ] works too. Juan Pablo Romero wrote: > Hello! > > given the definition > > def f(a,b): return a+b > > With this code: > > fs = [ lambda x: f(x,o) for o in [0,1,

pushing python to multiple windows machines

2005-10-21 Thread [EMAIL PROTECTED]
I am working on a project that requires python to be installed on a large number of windows servers and was wondering if anyone has found a method to do this. I found the article from 2003, but nobody ever stated that they have found an option for this. http://groups.google.com/group/comp.lang.py

Re: pushing python to multiple windows machines

2005-10-21 Thread [EMAIL PROTECTED]
hey tim - Thanks for you input. I'm looking at it from the Windows perspective of needing to push a python interpreter out to multiple machines. I'll check out Moveable Python as you suggested. thanks -shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 date problems: "Can't adapt"

2005-10-21 Thread [EMAIL PROTECTED]
Is "None" a valid value for SQL ? Or should it be NULL ? May be it is because your input is NULL which is being converted to None in python but haven't been converted back to NULL on its way out. Steve Holden wrote: > I'm trying to copy data from an Access database to PostgreSQL, as the > latter n

Re: pushing python to multiple windows machines

2005-10-21 Thread [EMAIL PROTECTED]
Thanks Roger & Larry. Both of your suggestions are very helpful! -shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: Binding a variable?

2005-10-21 Thread [EMAIL PROTECTED]
I think not. temp is a name, not a variable. I believe temp=5 means it points to an immutable object 5. temp=6 means now it points to another immutable object 6. list=[temp] would resolve to whatever object temp is pointed to at that moment. You can try temp=[1]. Paul Dale wrote: > Hi everyone, >

Re: Execute C code through Python

2005-10-21 Thread [EMAIL PROTECTED]
Grant Edwards wrote: > On 2005-10-21, Ernesto <[EMAIL PROTECTED]> wrote: > > > Thanks. Can anyone provide an example of using *subprocess* to run > > helloWorld.C through the python interpreter. > > No. You can't run a .C file Unless you have a C interp

Re: Help with language, dev tool selection

2005-10-21 Thread [EMAIL PROTECTED]
Hi Vasilije, Try the Python 411 Podcast for a good introduction. http://www.awaretek.com/plf.html Cheers, Davy Mitchell http://www.latedecember.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python variables are bound to types when used?

2005-10-21 Thread [EMAIL PROTECTED]
Diez B. Roggisch wrote: > [EMAIL PROTECTED] wrote: > > Fredrik Lundh wrote: > > > >>reset your brain: > >> > >>http://effbot.org/zone/python-objects.htm > > > > > > Neat link. > > > > Can you expand on this: > >

access dictionary with preferred order ?

2005-10-21 Thread [EMAIL PROTECTED]
Hi, I am wondering if there is a dictionary data type that allows me to define the order of access when iterating it using items/keys etc. ? An example: a=dict(a=dict(), c=dict(), h=dict()) prefer=['e','h', 'a'] for x in a.values: print x would give me {h:dict()}, {a:dict()}, then the rest whi

Re: access dictionary with preferred order ?

2005-10-21 Thread [EMAIL PROTECTED]
e.com/ASPN/Cookbook/Python/Recipe/438823 > > On Friday 21 October 2005 21:18, [EMAIL PROTECTED] wrote: > > Hi, > > > > I am wondering if there is a dictionary data type that allows me to > > define the order of access when iterating it using items/keys etc. ? > > &g

High Order Messages in Python

2005-10-22 Thread [EMAIL PROTECTED]
I'm reading about "high order messages" in Ruby by Nat Pryce, and thinking if it could be util and if so, if it could be done in Python. Someone already tried? References: http://lambda-the-ultimate.org/node/view/1047 http://nat.truemesh.com/archives/000535.html http://nat.truemesh.com/archives/0

Re: best way to replace first word in string?

2005-10-22 Thread [EMAIL PROTECTED]
The RE way, was much slower I used the spilt, it was better I tought because there was no need to take it to the memory again, but it just my thougth -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >