Python Forum
ranch expression - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: ranch expression (/thread-25758.html)



ranch expression - Skaperen - Apr-11-2020

i have in mind a few commands i want to implement in which arguments or input will need to express a number or a range (possibly with an increment). i want to implement a function that will take a string with such an expression and return a list of 1 to 3 numbers (generally ints but perhaps also floats .. maybe even complex) being expressed. a simpler command i will rewrite is one that outputs select lines from a file. i am looking for ideas on what the syntax of a range expression in a string (str or bytes) should be like so i can first write a parser function for it that returns a list if it is in a valid firm or False if it is invalid (None if the arguments are bad, such as the expression being an unparseable type). what are your ideas?