Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: eval lambda function with restricted context
Post: RE: eval lambda function with restricted context

Regarding security, I know that it is not absolutely safe. But IMO it's better to do something partly than do nothing. I think that Stranac gave a good hint! Use the globals! Accordingly, the followi...
Olivier General Coding Help 7 5,108 Mar-04-2019, 10:45 PM
    Thread: eval lambda function with restricted context
Post: RE: eval lambda function with restricted context

Sorry, my browser sent the message while I was writing it, against my will. I start again. You want me to write a general parser for mathematical expressions? I won't do that! First, it is a huge wor...
Olivier General Coding Help 7 5,108 Mar-04-2019, 08:02 PM
    Thread: eval lambda function with restricted context
Post: RE: eval lambda function with restricted context

My code is of course a minimal working example. Instead of "exp(1)" there will be an abritray expression supplied by the user.
Olivier General Coding Help 7 5,108 Mar-04-2019, 05:59 PM
    Thread: eval lambda function with restricted context
Post: eval lambda function with restricted context

Hello, I would like to create a lambda function accessing Numpy functions, and only them. I can do the following: import numpy eval('exp(1)', {'__builtins__': None}, numpy.__dict__)Output:2.71828182...
Olivier General Coding Help 7 5,108 Mar-04-2019, 04:59 PM
    Thread: Invalid Syntax
Post: RE: Invalid Syntax

Line 2: missing parenthesis Line 6: "elif" should not be indented
Olivier General Coding Help 3 2,302 Mar-04-2019, 04:33 PM
    Thread: List creation and return in Function
Post: RE: List creation and return in Function

Line 6 is not properly indented.
Olivier General Coding Help 3 2,413 Mar-04-2019, 04:25 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020