Some specific exec behavior ?

S

Stef Mientki

hello,

I find 2 strange behaviors in exec-function,
and I can't find anything in the documentation.
(Python 2.4.3 Enthought edition)

1. A function definition may not span more than 1 line, e.g.
This generates an exception:
def _func (x,y):
return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)

while this works correct:
def _func (x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)

2. an emtpy line at the end also generates an exception

Is this behavior correct ?
where should I find information about it ?

thanks,
Stef Mientki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top