January 8th, 2013, 02:06 PM
So, why does this not work then?
hey, does anyone know why this won't work for me?
and the easiest possible way to make it work? (simple and short )
when i run this code, I get "SyntaxError: 'return' outside function". I have also tried to leave out the ,test.__dict__ part, but still won't work for me.
January 8th, 2013, 02:50 PM
think i might know why it doesnt work..
it does not appear like this is supposed to work.
http:// docs.python.org /3.1/library/functions.html#exec
now to work out a workaround.. :l
January 8th, 2013, 03:05 PM
also, this does not seem to work... grrrr..
the print part works fine, but the return part bring up the error: SyntaxError: invalid syntax
January 8th, 2013, 04:35 PM
Last edited by b49P23TIvg; January 8th, 2013 at 04:36 PM.
Reason: insert code tags
[/code] are essential for python code and Makefiles!
January 8th, 2013, 09:05 PM
I don't think it is possible to do what you're trying to do, but maybe if you could explain why you're trying to do it someone can come up with something similar?
January 9th, 2013, 11:47 AM
thanks for the help, after writing a detailed explanantion on what i want to do, I realised how I could achive a solution to the problem myself.. sometimes it helps to wirte things out loud ;-) (my solution is to have a while loop inside the function which depends on a boolean being true, and then change the value of the boolean instead... so simple really :S)