Re: how to "normalize" indentation sources

2006-05-24 Thread AndyL
John Machin wrote: > On 25/05/2006 12:00 PM, AndyL wrote: > >> Hi, >> >> I have a lot of sources with mixed indentation typically 2 or 4 or 8 >> spaces. Is there any way to automatically convert them in let's say 4 >> spaces? >> > > Yup

deploying big python applications

2006-05-24 Thread AndyL
Hi, let me describe how I do that today. There is standard python taken from python.org installed in a c:\python23 with at least dozen different additional python packages (e.g. SOAPpy, Twisted, wx, many smaller ones etc) included. Also python23.dll moved from c:\windows to c:\python23. This

how to "normalize" indentation sources

2006-05-24 Thread AndyL
Hi, I have a lot of sources with mixed indentation typically 2 or 4 or 8 spaces. Is there any way to automatically convert them in let's say 4 spaces? Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

Re: Web framework comparison video

2006-05-23 Thread AndyL
Iain King wrote: > http://compoundthinking.com/blog/index.php/2006/03/10/framework-comparison-video/ > > Thought this might be interesting to y'all. (I can't watch it 'cos I'm > at work, so any comments about it would be appreciated :) Indeed it was. The headache factor is 1, for some reason my

Re: python equivalent of the following program

2006-05-11 Thread AndyL
Edward Elliott wrote: > AndyL wrote: > >>Edward Elliott wrote: >> >>>And if the script runs somewhere that stderr is likely to disappear: >>> >>>prog1 = subprocess.Popen(['prog1'], stdout=file1, >>>stderr=subprocess.STDOUT) >&

Re: Chicago Python Users Group Thurs May 11 at 7pm

2006-05-11 Thread AndyL
Brian Ray wrote: > This will be our best meeting yet! ChiPy's Monthly meeting this Thurs. > May 11, 2006. 7pm. > I will miss it. When the next is planed? -- http://mail.python.org/mailman/listinfo/python-list

Re: python equivalent of the following program

2006-05-11 Thread AndyL
Edward Elliott wrote: > Steven Bethard wrote: > >>import subprocess >> >>file1 = open('file1', 'w') >>prog1 = subprocess.Popen(['prog1'], stdout=file1) > > > And if the script runs somewhere that stderr is likely to disappear: > > prog1 = subprocess.Popen(['prog1'], stdout=file1, stderr=subproc

Re: redirecting print to a a file

2006-05-11 Thread AndyL
Sybren Stuvel wrote: > AndyL enlightened us with: > >>And what if I want to still send the output to stdout and just a log >>it in the file as well? > > > $ python some_program.py | tee output.log > > Or write a class that has a write() function and output

Re: redirecting print to a a file

2006-05-11 Thread AndyL
Sybren Stuvel wrote: >>I have a large program and would like to avoid touching hundreds of >>print's. > > > I can suggest using the logging module instead of print. It's much > more flexible than prints, and well suited for large programs. > Thx for the hint. I will look into that. A. -- http

Re: redirecting print to a a file

2006-05-11 Thread AndyL
Harold Fellermann wrote: import sys sys.stdout = file("output","w") print "here you go" > > And what if I want to still send the output to stdout and just a log it in the file as well? A. -- http://mail.python.org/mailman/listinfo/python-list

python equivalent of the following program

2006-05-11 Thread AndyL
Hi, What would by a python equivalent of following shell program: #!/bin/sh prog1 > file1 & prog2 > file2 & As you see, I need to spawn a few processes and redirect stdout to some files. Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

redirecting print to a a file

2006-05-11 Thread AndyL
Hi, Can I redirect print output, so it is send to a file, not stdout. I have a large program and would like to avoid touching hundreds of print's. Thx, Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: __all__ does not work?

2006-05-09 Thread AndyL
[EMAIL PROTECTED] wrote: > Andy> This a mm.py module: > Andy> _all__=('getsize1',) > > Andy> size=85 > > Andy> def getsize1(): > Andy> return size > > Andy> def getsize2(): > Andy> return 2*size > > > Andy> I do not know why but getsize2 is not kept pr

__all__ does not work?

2006-05-09 Thread AndyL
This a mm.py module: _all__=('getsize1',) size=85 def getsize1(): return size def getsize2(): return 2*size I do not know why but getsize2 is not kept priviate? $ python Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credi

Re: using range() in for loops

2006-04-05 Thread AndyL
Paul Rubin wrote: > Normally you'd use range or xrange. range builds a complete list in > memory so can be expensive if the number is large. xrange just counts > up to that number. so when range would be used instead of xrange. if xrange is more efficient, why range was not reimplemented? --

Re: what is the the best way to express following:

2006-03-27 Thread AndyL
Paul McGuire wrote: > "AndyL" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>if type(key).__name__ == "int" or type(key).__name__ == "long": >> abc() >>elif type(key).__name__ == "str": >>

Re: what is the the best way to express following:

2006-03-27 Thread AndyL
James Stroud wrote: > Here is a suggestion > > todo = {(int, long):abc, (str,):afg, (tuple, list):ijk} > todo[type(key)]() Is not that a shortcut? I have got "KeyError" exception ... -- http://mail.python.org/mailman/listinfo/python-list

what is the the best way to express following:

2006-03-27 Thread AndyL
if type(key).__name__ == "int" or type(key).__name__ == "long": abc() elif type(key).__name__ == "str": efg() elif type(key).__name__ == "tuple" or type(key).__name__ == "list": ijk() In other words I need to determinie intiger type or string or []/() in elegant way, possibly with

Re: path to modules per import statement

2006-03-24 Thread AndyL
[EMAIL PROTECTED] wrote: >>For instance: "import my.path.module" would load module from >>./my/path/module.py? > > > Yeah, just do that. I don't understand the question, it works just like > this today. > I work on rather big set of Python applications: something like 100 .py files divided int

path to modules per import statement

2006-03-23 Thread AndyL
Hi, is there any way to specify the path to modules within import statement (like in Java)? For instance: "import my.path.module" would load module from ./my/path/module.py? Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

multi/double dispatch, multifunctions once again

2006-02-15 Thread AndyL
Hi, Where I can find a module supporting that? A. -- http://mail.python.org/mailman/listinfo/python-list