Re: exec-function in Python 3.+

2009-11-02 Thread Dave Angel
Hans Larsen wrote: Help! I'm begginer in Python 3.+! If i wih to update a module after an import and chages, How could I do: By "from imp import reload" and then reload(mymodule) or how to use "exec(?)", it is mentoined in docs. In Python ver. <3 reload(module) writes some

Re: exec-function in Python 3.+

2009-11-02 Thread Jon Clements
On 2 Nov, 10:49, "Hans Larsen" wrote: > Help! >     I'm begginer in Python 3.+! >     If i wih to update a module after an import and chages, >     How could I do: >     By "from imp import reload" and then reload(mymodule) >     or how to use "exec(?)", it is mentoined in docs. >     In Python ve

exec-function in Python 3.+

2009-11-02 Thread Hans Larsen
Help! I'm begginer in Python 3.+! If i wih to update a module after an import and chages, How could I do: By "from imp import reload" and then reload(mymodule) or how to use "exec(?)", it is mentoined in docs. In Python ver. <3 reload(module) writes something back to interpr

Re: Triple quoted string in exec function ?

2009-01-02 Thread Steven D'Aprano
On Fri, 02 Jan 2009 14:39:25 +0100, Stef Mientki wrote: > thanks for all the answers, > but I still don't understand it yet :-( So maybe someone could explain > why the next few lines of code don't work: > > Code = '' > Code += """multiline comment > and more lines""" > exec ( Code ) You don't

Re: Triple quoted string in exec function ?

2009-01-02 Thread John Machin
On Jan 3, 12:39 am, Stef Mientki wrote: > Stef Mientki wrote: > > hello, > > > I'm running scripts, with the execute function (Python 2.5), > > and it seems that triple quoted strings are not allowed. > > > Is there a workaround, > > or is thi

Re: Triple quoted string in exec function ?

2009-01-02 Thread Stef Mientki
Stef Mientki wrote: hello, I'm running scripts, with the execute function (Python 2.5), and it seems that triple quoted strings are not allowed. Is there a workaround, or is this a fundamental problem of the exec-function ? thanks, Stef Mientki thanks for all the answers, but I still

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
Steven D'Aprano wrote in news:016abfa1$0$6988$c3e8...@news.astraweb.com in comp.lang.python: > On Tue, 30 Dec 2008 15:35:28 -0600, Rob Williscroft wrote: > >> Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- >> l...@python.org in comp.lang.python: >> > And, by the way, exec i

Re: Triple quoted string in exec function ?

2008-12-30 Thread John Machin
e execute function (Python 2.5), > >>>> and it seems that triple quoted strings are not allowed. > >>>>       Is there a workaround, > >>>> or is this a fundamental problem of the exec-function ? > > >>> If you think about it, it should be obvi

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 15:35:28 -0600, Rob Williscroft wrote: > Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- > l...@python.org in comp.lang.python: > And, by the way, exec is a *statement*, not a function! >> exec ( Init_Code, PG.P_Globals ) >> >> I've really

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 21:16:39 +0100, Stef Mientki wrote: > I guess I've to remove all triple quoted strings from my code. There's no problem with triple-quoted strings. You just have to quote them properly. >>> text = """x = 1 ... y = x+2 ... del x ... print y ... """ >>> exec text 3 You can

Re: Triple quoted string in exec function ?

2008-12-30 Thread Gabriel Genellina
En Tue, 30 Dec 2008 18:16:39 -0200, Stef Mientki escribió: ibpe...@gmail.com wrote: the message Steven sent you is ok to explain how to work with triple quote Yes, but not to work around my problem. I guess I've to remove all triple quoted strings from my code. Why so? You only have to a

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- l...@python.org in comp.lang.python: >>> And, by the way, exec is a *statement*, not a function! >>> > exec ( Init_Code, PG.P_Globals ) > > I've really doubt that this is a statement, > unless I don't understand what a sta

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steve Holden
it seems that triple quoted strings are not allowed. >>>> Is there a workaround, >>>> or is this a fundamental problem of the exec-function ? >>>> >>> If you think about it, it should be obvious that you can't surround a >>> strin

Re: Triple quoted string in exec function ?

2008-12-30 Thread Jean-Paul Calderone
ere a workaround, or is this a fundamental problem of the exec-function ? If you think about it, it should be obvious that you can't surround a string to be compiled with any of the quotes that appear inside the string to be compiled. That's about the only limitation I am aware of.

Re: Triple quoted string in exec function ?

2008-12-30 Thread Stef Mientki
em of the exec-function ? If you think about it, it should be obvious that you can't surround a string to be compiled with any of the quotes that appear inside the string to be compiled. That's about the only limitation I am aware of. And, by the way, exec is a *statement*,

Re: Triple quoted string in exec function ?

2008-12-30 Thread ibpet11
On Dec 30, 2:48 pm, Steve Holden wrote: > Stef Mientki wrote: > > hello, > > > I'm running scripts, with the execute function (Python 2.5), > > and it seems that triple quoted strings are not allowed. > > > Is there a workaround, > > or is this a funda

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steve Holden
Stef Mientki wrote: > hello, > > I'm running scripts, with the execute function (Python 2.5), > and it seems that triple quoted strings are not allowed. > > Is there a workaround, > or is this a fundamental problem of the exec-function ? > If you think about it,

Triple quoted string in exec function ?

2008-12-30 Thread Stef Mientki
hello, I'm running scripts, with the execute function (Python 2.5), and it seems that triple quoted strings are not allowed. Is there a workaround, or is this a fundamental problem of the exec-function ? thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

Re: Doubt regarding exec function

2005-03-22 Thread Diez B. Roggisch
Mosas wrote: > Dear All, > Php has exec function to run system commands and > this function return last line of system command > result. But in Python I can see only os.system() > function to run system command but it doesn't return > any result like php exec function

Doubt regarding exec function

2005-03-22 Thread Mosas
Dear All, Php has exec function to run system commands and this function return last line of system command result. But in Python I can see only os.system() function to run system command but it doesn't return any result like php exec function. I want to know about php equivalent

Re: exec function

2005-02-12 Thread scott m
Thanks, both of these examples will help me clean my code and improve it. Scott -- http://mail.python.org/mailman/listinfo/python-list

Re: exec function

2005-02-12 Thread tertius
[EMAIL PROTECTED] wrote: I'm a newbie to pthyon and I am creating an app with wxPython. I have 7 tables (more on the way... they are feed from a database) that need to be formatted in a certain way (DataTable() does this) and I am just looking for a cleaner way to pass all of the Grids (grid_1, gri

Re: exec function

2005-02-12 Thread Jeff Epler
In this case, you can use getattr() instead of the exec statement: getattr(self.frame, t).SetTable(DataTable(d, r[0]), True) Jeff pgp6KrffC7xJf.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

exec function

2005-02-12 Thread [EMAIL PROTECTED]
I'm a newbie to pthyon and I am creating an app with wxPython. I have 7 tables (more on the way... they are feed from a database) that need to be formatted in a certain way (DataTable() does this) and I am just looking for a cleaner way to pass all of the Grids (grid_1, grid_2, etc) through the sam