Python Forum
a range in command line arguments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a range in command line arguments
#4
I mean that the users can write range(3, 5) but your code can parse the expression by using ast.parse() and produce the list [3, 4]. The code could traverse the abstract syntax tree to see if the expression entered by the user belongs to a set of allowed expression. That way, you can have the effect of eval() without the risks.
Reply


Messages In This Thread
a range in command line arguments - by Skaperen - Sep-11-2018, 11:33 PM
RE: a range in command line arguments - by Skaperen - Sep-13-2018, 02:16 AM
RE: a range in command line arguments - by Gribouillis - Sep-13-2018, 04:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  command line progam wanted: clock Skaperen 2 2,700 Apr-18-2018, 06:54 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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