Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 another way to make Python easier
#1
Python already accepts an extra comma after the last item of a source sequence of expressions, such as forming a list:
mylist = [
'foo',
'bar',
]
that allows scripts that generate to need to deal with skipping the code that outputs the comma after the last item, for example.

another idea i have applies to having an "if" statement followed by a bunch of "elif" statements. the idea is to allow "elif" as an alternative of "if" for a similar reason... so the code generator does not have to check if this is the first.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
It doesn't work, the grammar becomes ambiguous.
if a:
   ...
if b:
   ...
elif c:
   ...
cannot be equivalent to
if a:
   ...
elif b:
   ...
elif c:
   ...
Skaperen likes this post
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  which would be easier to translate to Python? Skaperen 2 870 Oct-28-2017, 05:06 AM
Last Post: Skaperen

Forum Jump:


Users browsing this thread: 1 Guest(s)