Python Forum
another way to make Python easier
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#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:
   ...
Reply


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

Forum Jump:

User Panel Messages

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