Python Forum
feature request: ternary fallthroughs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
feature request: ternary fallthroughs
#7
this isnt about parsing args or using modules lol, also i forgot to do a commit that attempts to explain things better in example.py, should be up to date.

heres what is happening:
val = int(sys.argv[1]) if int(sys.argv[1]) else fallthrough

1. val will be converted into an int

IF

The supplied arg is indeed an int. any type that is not an int will fail otherwise

IN WHICH CASE

fallthrough to the next case, which handles the event now.

It's error handling with a single word. And when you supply this program with a zero, it will just not make any matches, which isn't an error at all. the program is running as expected.

Look people, i didnt invent the idea, ken thompson (you know the guy that cowrote UNIX and C) did, so i guess if you're smarter than ken thompson, sure. this doesnt make any sense.
Reply


Messages In This Thread
feature request: ternary fallthroughs - by rexrf - May-05-2021, 12:57 PM
RE: feature request: ternary fallthroughs - by rexrf - May-05-2021, 07:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python on a ternary computer Skaperen 0 1,615 Jun-20-2020, 02:21 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