Re: like a "for loop" for a string

2008-08-18 Thread B
Mensanator wrote: On Aug 17, 6:03�pm, B <[EMAIL PROTECTED]> wrote: Alexnb wrote: Uhm, "string" and "non-string" are just that, words within the string. Here shall I dumb it down for you? string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes text6 �no text7 yes text8" It doesn

Re: print "%s"

2008-08-18 Thread Bruno Desthuilliers
Cameron Simpson a écrit : On 18Aug2008 11:58, Beema Shafreen <[EMAIL PROTECTED]> wrote: | In my script i have to print a series of string , so | | print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") | | I need to know instead of typing so many %s can i write %6s in python, as | we do

Re: list/tuple/dict question

2008-08-18 Thread Bruno Desthuilliers
bruce a écrit : hi guys/gals... got a basic question that i can't get my hands around. i'm trying to programatically create/use a list/tuple (or whatever the right phrase in pyton is!!) basically, something like: foo = [] foo.append('cat') foo.append('dog') foo[1] = [] (and in this case,

Re: How to delete a line with re?

2008-08-18 Thread John Machin
On Aug 18, 4:22 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Peng Yu wrote: > > I want to delete the line with abc in the following program. But the > > following program does not do what I want. Can somebody let me know > > how to do it? > > file="""abcd > > efg > > hijk > > lmn > > """ > > > rege

Re: You advice please

2008-08-18 Thread Hussein B
On Aug 15, 10:05 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Hussein B a écrit : > (snip) > > > But this critisim looks so serious: > >http://en.wikipedia.org/wiki/Ruby_programming_language#Criticism > > Most of what's written here could apply to Python too - all the part > which mostly re

ANN: bbfreeze 0.96.3

2008-08-18 Thread [EMAIL PROTECTED]
Hi all, I uploaded bbfreeze 0.96.3 to python's cheeseshop. bbfreeze creates standalone executables from python scripts (similar to py2exe). bbfreeze works on windows and unix-like operating systems (no OS X unfortunately). bbfreeze is able to freeze multiple scripts, handle egg files and track bin

if in expression

2008-08-18 Thread christian2 . schmidt
Hi, I'm using IronPython to evaluate expressions, so I can't use the return statement but have to say it in an one-liner. Using C/C++ I could use "cond ? then : else" to have an expression-if, but in Python there's no such operator. The "cond and then or else"-trick only seems to work for non-false

Re: if in expression

2008-08-18 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I'm using IronPython to evaluate expressions, so I can't use the return statement but have to say it in an one-liner. Using C/C++ I could use "cond ? then : else" to have an expression-if, but in Python there's no such operator. The "cond and then or else"-trick onl

Re: online tutorials?

2008-08-18 Thread Gerard Flanagan
On Aug 18, 12:53 am, Gits <[EMAIL PROTECTED]> wrote: > I want to learn how to program in python and would like to know if you > guys know of any free online tutorials.  Or is it too complicated to > learn from a site or books? Some texts and examples here: http://thehazeltree.org/ hth G. -- htt

Re: if in expression

2008-08-18 Thread John Machin
On Aug 18, 5:46 pm, [EMAIL PROTECTED] wrote: > Hi, > I'm using IronPython to evaluate expressions, so I can't use the > return statement but have to say it in an one-liner. By "evaluate expressions", do you mean using the eval built-in function? If so, find the recent thread addressing this topic;

execute another python script

2008-08-18 Thread Alexandru Mosoi
how do I execute another python script under a different process? I want the script to be run using the same interpretoer as the one running current script. I tried using os.execlp but I don't know how to get the name/path of the interpreter. -- http://mail.python.org/mailman/listinfo/python-list

Re: if in expression

2008-08-18 Thread Fredrik Lundh
John Machin wrote: There is an even more unreadable hack (due to Tim Peters IIRC) that avoides the false-then problem: (cond and [then_value] or [else_value])[0] The correct attribution is "due to Tim Peters (who wishes it was Steve Majewski)." -- http://mail.python.org/mailman/listinfo/

Re: if in expression

2008-08-18 Thread Hrvoje Niksic
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Since python 2.5, it is > > if else > > If you want lazy evaluation, you can use lambdas: > > iif(cond, lambda: then, lambda: else_)() Your code uses "iif" and attempts to evaluate a tuple; could you post an example that works? I ask because it

Bizarre method keyword-arg bug.

2008-08-18 Thread Jasper
I'm stumped. I'm calling a method that has keyword args, but not setting them, and yet one of them starts off with data?! The class definition begins like so: class BattleIntentionAction( BattleAction ): def __init__( self, factionName, location, tactic='hold', targetFacName='', terrainArgs=

Re: execute another python script

2008-08-18 Thread Fredrik Lundh
Alexandru Mosoi wrote: how do I execute another python script under a different process? I want the script to be run using the same interpretoer as the one running current script. I tried using os.execlp but I don't know how to get the name/path of the interpreter. >>> import sys, subprocess >

Re: if in expression

2008-08-18 Thread Diez B. Roggisch
Hrvoje Niksic schrieb: "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: Since python 2.5, it is if else If you want lazy evaluation, you can use lambdas: iif(cond, lambda: then, lambda: else_)() Your code uses "iif" and attempts to evaluate a tuple; could you post an example that works?

Re: if in expression

2008-08-18 Thread Fredrik Lundh
Hrvoje Niksic wrote: If you want lazy evaluation, you can use lambdas: iif(cond, lambda: then, lambda: else_)() Your code uses "iif" and attempts to evaluate a tuple; could you post an example that works? I ask because it's not clear what you mean by lazy evaluation in this context. The ter

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Simon Brunning
2008/8/18 Jasper <[EMAIL PROTECTED]>: > I'm stumped. I'm calling a method that has keyword args, but not > setting them, and yet one of them starts off with data?! -- Cheers, Simon B. [EMAIL PROTECTED] http:/

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Diez B. Roggisch
Jasper schrieb: I'm stumped. I'm calling a method that has keyword args, but not setting them, and yet one of them starts off with data?! The class definition begins like so: class BattleIntentionAction( BattleAction ): def __init__( self, factionName, location, tactic='hold', targetFacNam

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Jasper wrote: I'm stumped. I'm calling a method that has keyword args, but not setting them, and yet one of them starts off with data?! The class definition begins like so: class BattleIntentionAction( BattleAction ): def __init__( self, factionName, location, tactic='hold', targetFacName

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Fredrik Lundh wrote: default argument values are evaluated when the function object is created (by the "def" statement, that is), not when the resulting function is called. if you mutate the default values, the mutations will stick. and yes, workarounds and further details are provided here

Re: online tutorials?

2008-08-18 Thread Wojtek Walczak
On Sun, 17 Aug 2008 15:53:38 -0700 (PDT), Gits wrote: > I want to learn how to program in python and would like to know if you > guys know of any free online tutorials. Or is it too complicated to > learn from a site or books? Try this: http://linkmingle.com/list/List-of-Free-Online-Python-Books

Re: Factory for Struct-like classes

2008-08-18 Thread Gabriel Genellina
On 13 ago, 14:46, eliben <[EMAIL PROTECTED]> wrote: > On Aug 13, 7:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > eliben wrote: > > > Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html) > > > does this. I suppose it can be done with 'exec', but is there a more > > > Pytho

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Jasper
On Aug 18, 1:49 am, "Simon Brunning" <[EMAIL PROTECTED]> wrote: > 2008/8/18 Jasper <[EMAIL PROTECTED]>: > > > I'm stumped. I'm calling a method that has keyword args, but not > > setting them, and yet one of them starts off with data?! > >

Re: execute another python script

2008-08-18 Thread Alexandru Mosoi
On Aug 18, 11:34 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >  >>> import sys, subprocess >  >>> subprocess.call([sys.executable, "-c", "print 'hello'"]) > hello > 0 10x :). exactly what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Re: like a "for loop" for a string

2008-08-18 Thread Fredrik Lundh
Wojtek Walczak wrote: Got no idea, but it might be a nice try. It should be a quite good memory saver for very large strings. or you could use re.finditer, which can be used for a lot more than just splitting. -- http://mail.python.org/mailman/listinfo/python-list

Re: The Importance of Terminology's Quality

2008-08-18 Thread Martin Gregorie
On Sun, 17 Aug 2008 22:30:35 -0400, John W Kennedy wrote: > I said "machine language" and I meant it. > OK - I haven't touched that since typing ALTER commands into the console of a 1903 running the UDAS executive or, even better, patching the executive on the hand switches. I was fascinated, t

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Jasper wrote: Uggg! /That's/ an intuitive side-effect/wart. :-/ it's done that way on purpose, of course, because evaluating a full closure for each default argument at every call would greatly hurt performance (and lead to another set of surprises, of course). please don't label things

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Jasper
On Aug 18, 2:40 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jasper wrote: > > Uggg! /That's/ an intuitive side-effect/wart. :-/ > > it's done that way on purpose, of course, because evaluating a full > closure for each default argument at every call would greatly hurt > performance (and lead t

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Paul Boddie
On 18 Aug, 11:40, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jasper wrote: > > Uggg!  /That's/ an intuitive side-effect/wart.  :-/ > > it's done that way on purpose, of course, because evaluating a full > closure for each default argument at every call would greatly hurt > performance (and lead to

HTML Tables

2008-08-18 Thread Amie
Afternoon all. Just want to know how to create html tables using a for loop. I need to display 34 html tables, so I figured a for loop will do. Please show me an example of how to do that. Also how do I display the results of an sql query onto the html tables? Thanks in advance -- http://mail.pyt

Enamel and Nevow

2008-08-18 Thread Amie
Hi, has any of you ever heard of enamel? It's web framework for python, if anyone has more info please let me know because I'm in need of some assistance with creating a website using enamel, nevow, stan, mysql and python. Thank You -- http://mail.python.org/mailman/listinfo/python-list

Re: how many nested for can we utilize?

2008-08-18 Thread Gabriel Genellina
En Sun, 17 Aug 2008 21:57:46 -0300, Patrol Sun <[EMAIL PROTECTED]> escribió: > Of course We needn't 100 levels,but I use the exec function can concise the > code. See the attachment. Just a note on the attached code: def isPro52Num(n): s=[] for i in range(1,7): s.

SQLite's default ON CONFLICT algorithm

2008-08-18 Thread egbert
Yes, I know that this is off-topic, but I feel justified by sqlite3 being a builtin. The default ON CONFLICT algorithm in SQLite is ABORT. The SQLite documentation ("ON CONFLICT clause") says that when a constraint violation occurs under ABORT, no rollback is executed, so changes from prior comma

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Jasper
On Aug 18, 3:04 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > Well, in the page of "Python warts" that I compiled when it was > claimed that Python 3000 addresses such issues in Python 2.x, the > "Mutable default arguments" entry lists at least one experienced > Python author who agrees with the i

Re: help with parsing email

2008-08-18 Thread Gabriel Genellina
En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> escribió: > I need to grab/parse numeric numbers such as app number from incoming > emails stored in Microsoft Outlook (Microsoft Exchange server) with > specified subject line. > > The email body is like this > > myregion ; tst

Re: print "%s"

2008-08-18 Thread Maric Michaud
Le Monday 18 August 2008 09:27:33 Bruno Desthuilliers, vous avez écrit : > Cameron Simpson a écrit : > > On 18Aug2008 11:58, Beema Shafreen <[EMAIL PROTECTED]> wrote: > > | In my script i have to print a series of string , so > > | > > | print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") >

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Paul Boddie
On 18 Aug, 12:20, Jasper <[EMAIL PROTECTED]> wrote: > > Not surprising, as it's fairly non-standard.  I'd even argue that > calling them "default arguments" is a misnomer -- they're more akin to > static variables. Indeed, default parameter values are occasionally suggested for that purpose, altho

Windows / Tkinter - problem with grid - not able to place widgets at desired places

2008-08-18 Thread dudeja . rajat
> >Hi, > >I'm learning Python and Tkinter. I've started programming in Eclipse with >PyDev. >I'm intending to create a GUI. I'm not able to understand the Grid >manager perhaps because there is quite a less documentation available >for it on the net. > >My desired GUI is attached in the mail. Alth

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Maric Michaud
Le Monday 18 August 2008 07:11:59 Cameron Simpson, vous avez écrit : > You're probably confused by the fact that cron does not invoke "login" > shells (with their associated initialisation from /etc/profile and > $HOME/.profile). This can be solved by invoking /bin/bash -l -c ..., the -l option fo

Re: SQLite's default ON CONFLICT algorithm

2008-08-18 Thread Gerhard Häring
egbert wrote: Yes, I know that this is off-topic, but I feel justified by sqlite3 being a builtin. The default ON CONFLICT algorithm in SQLite is ABORT. The SQLite documentation ("ON CONFLICT clause") says that when a constraint violation occurs under ABORT, no rollback is executed, so changes

Re: help with parsing email

2008-08-18 Thread Maric Michaud
Le Monday 18 August 2008 12:43:02 Gabriel Genellina, vous avez écrit : > En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> escribió: > > I need to grab/parse numeric numbers such as app number from incoming > > emails stored in Microsoft Outlook (Microsoft Exchange server) with

Re: if in expression

2008-08-18 Thread Hrvoje Niksic
Fredrik Lundh <[EMAIL PROTECTED]> writes: > Hrvoje Niksic wrote: > >>> If you want lazy evaluation, you can use lambdas: >>> >>> iif(cond, lambda: then, lambda: else_)() >> >> Your code uses "iif" and attempts to evaluate a tuple; could you post >> an example that works? >> >> I ask because it's n

Programming Languages Decisions

2008-08-18 Thread E.D.G.
PROGRAMMING LANGUAGES DECISIONS Report Posted by E.D.G. August 18, 2008 This report is intended for any computer programming experts who would like to propose that their favorite programming language is the one that should be used for the potentially important application that is being

Re: HTML Tables

2008-08-18 Thread Adrian Smith
On Aug 18, 7:16 pm, Amie <[EMAIL PROTECTED]> wrote: > Afternoon all. > > Just want to know how to create html tables using a for loop. > I need to display 34 html tables, so I figured a for loop will do. > Please show me an example of how to do that. for i in range(33): print "" for j in r

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Edwin . Madari
source in or execute .profile (or .bash_profile which ever is applicable to you) as a first thing in the cron to get environment variables. hope that helps. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Sunday, August 17, 2008

Re: Usual practice: running/testing modules in a package

2008-08-18 Thread Gabriel Genellina
En Wed, 13 Aug 2008 04:57:32 -0300, alito <[EMAIL PROTECTED]> escribió: > Hi all, > > I am new to using packages to group my modules. I can't figure out > how to run a module that uses relative imports without writing a > wrapper that imports that module. Everything I try it complains that > I a

RE: pysyncml 0.1 released

2008-08-18 Thread Steffl, Joseph
-Original Message- From: Jérôme Laheurte [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2008 7:51 AM To: [EMAIL PROTECTED] Subject: pysyncml 0.1 released Hi, I'm happy to announce the first release of pysyncml, a Python wrapper for the Funambol C++ API. The project page, with exam

configuring temporary entry widget of TableList Cell using Python

2008-08-18 Thread lee . walczak
Hi, I am using Tkinter & the Kevin Walzer's TableList Wrapper for python implemented GUI: http://tkinter.unpythonic.net/wiki/TableListWrapper The TableList has been extremely useful in allowing me to create my GUI for my engineering requirements, but I have hit a brick wall and need some assista

Re: Vmware api

2008-08-18 Thread Edwin . Madari
do the ESX server provide any api's or an interactive session may ? thx. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Sunday, August 17, 2008 2:43 PM To: python-list@python.org Subject: Re: Vmware api I would also be intereste

Re: How to delete a line with re?

2008-08-18 Thread Edwin . Madari
running this snippet, is blanking out ^abdc$.. what is the issue ? abcd efg hijk lmn $ efg hijk lmn regards Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peng Yu Sent: Sunday, August 17, 2008 11:47 PM To: python-list@python.org Subject: How to de

Dropping privileges in python daemon

2008-08-18 Thread David Härdeman
I'm currently working on a python daemon which needs to be able to correctly drop privileges after opening ports and files that it needs to open as root. I'm used from C programming to use setresuid() to change the real, effective and saved uid in one go, and although the os module has some of the

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Shawn Milochik
Here's a more "English" version of what people are trying to explain: When you log into a Unix session, certain files in your home directory are read and add environment variables to your session. When you run a cron job, it does not do this. It still runs as "you" as far as permissions go, but it

auto-complete in html form input

2008-08-18 Thread JustWant2Ask JustWant2Ask
Hi, I am trying to write a data filtering routine based on the input received from a html form as follows: myFilter=(((var1>=1) and (var1<=5)) or (var2==10)) and not(var3) Is there any way of auto-completing the variables (var1, var2 and var3 in the example above) while typing in the input box o

AOP in Python

2008-08-18 Thread Hussein B
Hey, AOP is build in Groovy language via many means, does Python support AOP out of the box without the need for such tools: http://pythonsource.com/open-source/aspect-oriented-frameworks Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Getting pid of a remote process

2008-08-18 Thread srinivasan srinivas
Hi, Could you please suggest me a way to find pid of a process started on a remote machine by the current process?? I should get pid in the current process environment. The approach should be somewhat generic. It shouldn't expect the remote process to print its pid. Thanks, Srini Unlimit

Re: print "%s"

2008-08-18 Thread gundlach
The string.join() approach is better for your purpose, but FYI you can multiply a string to repeat it: In [2]: "%s\t" * 6 Out[2]: '%s\t%s\t%s\t%s\t%s\t%s\t' - Michael On Aug 18, 3:27 am, Bruno Desthuilliers wrote: > Cameron Simpson a écrit : > > > > > On 18Aug2008 11:58, Beema Shafreen <[EMAIL

Re: list/tuple/dict question

2008-08-18 Thread gundlach
Hi Bruce, I think I get what you're asking for -- you want to actually end up with a local variable 'cat' which points to an empty list, so that you can then do cat.append('foot') or whatever. The problem with the last line of this code (based on your attempt): foo=[] foo.append('cat') foo[0]

Re: like a "for loop" for a string

2008-08-18 Thread Boris Borcic
Alexnb wrote: Uhm, "string" and "non-string" are just that, words within the string. Here shall I dumb it down for you? string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes text6 no text7 yes text8" It doesn't matter what is in the string, I want to be able to know exactly

Re: Dropping privileges in python daemon

2008-08-18 Thread Matthias Bläsing
Am Mon, 18 Aug 2008 14:33:27 +0200 schrieb David Härdeman: > > I'm used from C programming to use setresuid() to change the real, > effective and saved uid in one go, and although the os module has some > of the set*uid() functions it doesn't seem to have setresuid(). no - python offers the posix

Python-URL! - weekly Python news and links (Aug 18)

2008-08-18 Thread Gabriel Genellina
QOTW: "COMP.LANG.PYTHON. We're so efficent, we deliver the answer before you can ask the question." - Travis Beaty http://groups.google.com/group/comp.lang.python/msg/0a976f29ec9f43e0 Named tuples, exec, closures, and why the old taxonomy of languages is no more relevant:

Re: pysyncml 0.1 released

2008-08-18 Thread Paul McGuire
> > Hi, > > I'm happy to announce the first release of pysyncml, a Python wrapper for the > Funambol C++ API. > Any chance you could say a bit more about what the Funambol C++ API is/ does? As this is a Python forum, I suspect many are not familiar with this undoubtedly invaluable and indispens

Re: Vmware api

2008-08-18 Thread Eric Wertman
On Mon, Aug 18, 2008 at 8:50 AM, <[EMAIL PROTECTED]> wrote: > do the ESX server provide any api's or an interactive session may ? Yes, there's a seemingly very full-featured API, that's documented here: http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/index.html They ha

Re: Good python equivalent to C goto

2008-08-18 Thread Chuck Rhode
On Sun, 17 Aug 2008 09:08:35 -0500, Grant Edwards wrote: > In Python one uses try/raise/except. At the risk of introducing an anachronism and in deference to Mr. "ElementTree" Lundh, I now invoke Godwin's Law (1990): Isn't *try/except* kinda sorta like the musty, old *come from* construct propos

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Steven D'Aprano
On Mon, 18 Aug 2008 04:07:14 -0700, Paul Boddie wrote: > Ultimately, I suppose one could enforce some kind of least surprising > "best practice" by limiting default parameter values to being literals > of immutable objects or names, as opposed to expressions, thus > eliminating some potential conf

Re: print "%s"

2008-08-18 Thread Beema Shafreen
Thanks a lot for your kind suggestions On Mon, Aug 18, 2008 at 7:07 PM, gundlach <[EMAIL PROTECTED]> wrote: > The string.join() approach is better for your purpose, but FYI you can > multiply a string to repeat it: > > In [2]: "%s\t" * 6 > Out[2]: '%s\t%s\t%s\t%s\t%s\t%s\t' > > - Michael > > On A

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Steven D'Aprano
On Mon, 18 Aug 2008 03:20:11 -0700, Jasper wrote: > It doesn't help that the solution to get the expected behavior involves > adding boiler-plate code all over. Expected by who? Please don't assume that everyone has had their intuition shaped by exposure to the same languages yours has been sha

Re: Good python equivalent to C goto

2008-08-18 Thread Robin Becker
Kurien Mathew wrote: Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (condition3) goto next; stmt1; stmt2; next: stmt3; stmt4; } s

Re: if in expression

2008-08-18 Thread Christian Schmidt
On 18 Aug., 10:22, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 18, 5:46 pm, [EMAIL PROTECTED] wrote: > > I'm using IronPython to evaluate expressions, so I can't use the > > return statement but have to say it in an one-liner. > > By "evaluate expressions", do you mean using the eval built-in >

Re: AOP in Python

2008-08-18 Thread Kay Schluehr
On 18 Aug., 15:21, Hussein B <[EMAIL PROTECTED]> wrote: > Hey, > AOP is build in Groovy language via many means, does Python support > AOP out of the box without the need for such > tools:http://pythonsource.com/open-source/aspect-oriented-frameworks > Thanks. http://groups.google.com/group/comp.

RE: Good python equivalent to C goto

2008-08-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Kurien Mathew > Sent: Saturday, August 16, 2008 5:21 PM > To: python-list@python.org > Subject: Good python equivalent to C goto > > Hello, > > Any suggestions on a good python equivalent for

Re: Good python equivalent to C goto

2008-08-18 Thread Paul McGuire
On Aug 17, 1:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > Kurien Mathew wrote: > > Hello, > > > Any suggestions on a good python equivalent for the following C code: > > > while (loopCondition) > > { > >     if (condition1) > >         goto next; > >     if (condition2) > >         goto

cathing uncaught exceptions

2008-08-18 Thread Alexandru Mosoi
how can I catch (globally) exception that were not caught in a try/ catch block in any running thread? i had this weird case that an exception was raised in one thread, but nothing was displayed/logged. -- http://mail.python.org/mailman/listinfo/python-list

Re: how many nested for can we utilize?

2008-08-18 Thread Lie
On Aug 17, 4:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Patrol Sun wrote: > > when I use 20 for ,"SystemError: too many statically nested blocks" > > When I use 100 for ,"IndentationError: too many levels of indentation" > > How to handle these errors? > > so why exactly are you trying to ne

Re: like a "for loop" for a string

2008-08-18 Thread Paul McGuire
On Aug 17, 3:12 pm, Alexnb <[EMAIL PROTECTED]> wrote: > Uhm, "string" and "non-string" are just that, words within the string. Here > shall I dumb it down for you? > > string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes > text6  no text7 yes text8" > > It doesn't matter what is

RE: how many nested for can we utilize?

2008-08-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Lie > Sent: Monday, August 18, 2008 11:04 AM > To: python-list@python.org > Subject: Re: how many nested for can we utilize? > > On Aug 17, 4:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >

Re: cathing uncaught exceptions

2008-08-18 Thread Paul McGuire
On Aug 18, 10:02 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > how can I catch (globally) exception that were not caught in a try/ > catch block in any running thread? i had this weird case that an > exception was raised in one thread, but nothing was displayed/logged. I suspect that your weir

RE: help with parsing email

2008-08-18 Thread Ahmed, Shakir
Thanks everyone who tried to help me to parse incoming email from an exchange server: Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. First I tried: >>> mailserver = 'EXCHVS01

Re: Factory for Struct-like classes

2008-08-18 Thread Dan Lenski
On Aug 13, 1:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Trynamedtuplehttp://code.activestate.com/recipes/500261/ > > Anamedtupleimplementation is part of Python 2.6 and 3.0. For older > versions of Python use the recipe from activestate. > > Christian This named tuple recipe is pretty co

Re: how many nested for can we utilize?

2008-08-18 Thread Patrol Sun
I test the exec function. As we all know, we can set the recursive levels. How to handle it? 2008/8/17 Fredrik Lundh <[EMAIL PROTECTED]> > Patrol Sun wrote: > > when I use 20 for ,"SystemError: too many statically nested blocks" >> When I use 100 for ,"IndentationError: too many levels of indent

Re: cathing uncaught exceptions

2008-08-18 Thread Alexandru Mosoi
On Aug 18, 6:18 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Aug 18, 10:02 am, Alexandru  Mosoi <[EMAIL PROTECTED]> wrote: > > > how can I catch (globally) exception that were not caught in a try/ > > catch block in any running thread? i had this weird case that an > > exception was raised in o

Re: Getting pid of a remote process

2008-08-18 Thread Diez B. Roggisch
srinivasan srinivas schrieb: Hi, Could you please suggest me a way to find pid of a process started on a remote machine by the current process?? I should get pid in the current process environment. The approach should be somewhat generic. It shouldn't expect the remote process to print its pid

Newbie problem inserting into MySQL

2008-08-18 Thread len
Hi All I have started a little pet project to learn python and MySQL. The project involves figuring out all the combinations for a 5 number lottery and storing the data in a MySQL file. The file looks like this; +--+-+--+-+- ++ | Field

Weird expression result

2008-08-18 Thread George Sakkis
I'm probably missing something obvious but I can't put my finger on it: >>> (3 in [3]) == True True >>> 3 in ([3] == True) Traceback (most recent call last): File "", line 1, in TypeError: argument of type 'bool' is not iterable >>> 3 in [3] == True False How/why does the last one evaluate t

Re: how many nested for can we utilize?

2008-08-18 Thread Patrol Sun
Thanks, I cannot utilize the String Class completely. I'm a newbie for python 2008/8/18 Gabriel Genellina <[EMAIL PROTECTED]> > En Sun, 17 Aug 2008 21:57:46 -0300, Patrol Sun <[EMAIL PROTECTED]> > escribió: > > > Of course We needn't 100 levels,but I use the exec function can concise > the > > co

Re: Weird expression result

2008-08-18 Thread Peter Otten
George Sakkis wrote: > I'm probably missing something obvious but I can't put my finger on > it: > (3 in [3]) == True > True > 3 in ([3] == True) > Traceback (most recent call last): > File "", line 1, in > TypeError: argument of type 'bool' is not iterable > 3 in [3] == True

Re: AOP in Python

2008-08-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Kay Schluehr <[EMAIL PROTECTED]> wrote: >On 18 Aug., 15:21, Hussein B <[EMAIL PROTECTED]> wrote: >> Hey, >> AOP is build in Groovy language via many means, does Python support >> AOP out of the box without the need for such >tools:http://pythonsource.com/open-source

mod_python and updated files

2008-08-18 Thread Aaron Scott
I have mod_python running on my server, but when I chance a Python file on the server, Apache needs to be restarted in order to have the changes take effect. I assume this is so mod_python can run persistently, but it's becoming quite a headache for development. Is there a way to turn off the persi

Re: Weird expression result

2008-08-18 Thread Dan Lenski
On Mon, 18 Aug 2008 18:04:32 +0200, Peter Otten wrote: > This works just like a < b < c: > 3 in [3] and [3] == True > False > > Peter Interesting. I agree with the OP that it is confusing! Does this expansion really get invoked every time there is an expression of the form?? expr1 binar

Re: Weird expression result

2008-08-18 Thread cokofreedom
On Aug 18, 5:57 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I'm probably missing something obvious but I can't put my finger on > it: > > >>> (3 in [3]) == True > > True > > >>> 3 in ([3] == True) > > Traceback (most recent call last): > File "", line 1, in > TypeError: argument of type 'bool

Re: Weird expression result

2008-08-18 Thread Peter Otten
Dan Lenski wrote: > On Mon, 18 Aug 2008 18:04:32 +0200, Peter Otten wrote: >> This works just like a < b < c: >> > 3 in [3] and [3] == True >> False > Interesting. I agree with the OP that it is confusing! > > Does this expansion really get invoked every time there is an expression > of th

Re: Weird expression result

2008-08-18 Thread George Sakkis
On Aug 18, 12:04 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'm probably missing something obvious but I can't put my finger on > > it: > > (3 in [3]) == True > > True > > 3 in ([3] == True) > > Traceback (most recent call last): > > File "", line 1, in > >

RE: Python does not get environment variable when using cron.

2008-08-18 Thread Stephen Cattaneo
- What did you run in the cronjob to get back all those variables? set; echo "-"; echo "import os; print os.environ" | python Cheers, S - -Original Message- - From: Asun Friere [mailto:[EMAIL PROTECTED] - Sent: Sunday, August 17, 2008 7:55 PM - To: python-list@python.o

Re: mod_python and updated files

2008-08-18 Thread Daniel Klein
On Mon, 18 Aug 2008 09:16:13 -0700 (PDT), Aaron Scott <[EMAIL PROTECTED]> wrote: >I have mod_python running on my server, but when I chance a Python >file on the server, Apache needs to be restarted in order to have the >changes take effect. I assume this is so mod_python can run >persistently, bu

handling Struct and global function for C module

2008-08-18 Thread Anish Chapagain
Hi, I have Structure in C, program and the structure is being used with various function inside C coding but am getting undefined referenced to global method and few of them too uses the sturct module. my problem goes like this, ex.h --- #define NIL 0 /* Indicates ptr is

Re: Good python equivalent to C goto

2008-08-18 Thread Matthew Fitzgibbons
Paul McGuire wrote: On Aug 17, 1:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: Kurien Mathew wrote: Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (

Re: help with parsing email

2008-08-18 Thread Werner F. Bruhin
Ahmed, Shakir wrote: Thanks everyone who tried to help me to parse incoming email from an exchange server: Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. First I tried: mai

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Robert Brown
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Mon, 18 Aug 2008 03:20:11 -0700, Jasper wrote: > "And no, the alternative /does not/ have an equivalent set of surprises > -- it's not like Python is unique in having default arguments." > > That's simply not true. I would find this behaviour very

Re: Weird expression result

2008-08-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: 3 in [3] == True http://docs.python.org/ref[3/summary.html that page is broken, as recently mentioned; "in", "not in", "is", and "is not" are comparison operators too, chains in the same way as the others. for details, see: http://docs.python.org/ref/compari

RE: help with parsing email

2008-08-18 Thread Ahmed, Shakir
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Werner F. Bruhin Sent: Monday, August 18, 2008 1:04 PM To: python-list@python.org Cc: [EMAIL PROTECTED] Subject: Re: help with parsing email Ahmed, Shakir wrote: > Thanks everyone who tried to help me to pa

  1   2   >