Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
it reminds me of an old boss who hated python doggedly. I once tried to explain list / dictionary comprehensions to him and he just couldn't make heads or tails of it. despite the fact it has been imp... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 09:42 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-06-2021, 09:29 AM)Gribouillis Wrote: rexrf Wrote:A foolish consistency is the hobgoblin of little mindsWe don't have to take every quotation as an enlightening thought. That one was coined by R... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 09:38 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-06-2021, 09:05 AM)rexrf Wrote: [quote="Gribouillis" pid='141725' dateline='1620291147']
I vote against the fallthrough because of import this.
Readability counts! In Python when you have this ... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 09:07 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-06-2021, 08:52 AM)Gribouillis Wrote: I vote against the fallthrough because of import this.
Readability counts! In Python when you have this structure
if ...:
...
else:
...you can be 100... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 09:05 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-06-2021, 07:37 AM)ndc85430 Wrote: Can you point us to an example in another language that does this? I've not seen it before, so must be unfamiliar with those languages.
I'm not sure if it's wo... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 08:01 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
traditional OO.
This belief that some idea or concept is only true only if it's always true, is a fools errand.
You will find many seemingly random features in python. your assumption that since its... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-06-2021, 02:58 AM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
thanks for everyone engaging with me on this. for real; i wanted to see how the idea would be received and i did
**angel** |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 08:45 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
sorry a lot too unpack, I hope I address it all.
No i think fallthrough is a great addition for flow control in general. My example is how it can be used in an already great evaluation tool. And Whil... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 08:43 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-05-2021, 07:31 PM)ndc85430 Wrote: I don't get what you're trying to do either. I am half wondering if what you want is a result monad, though.
I'm not sure what to tell you, this is a fully im... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 07:44 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
okay bud heres how ternary operators work
val = thing IF (this condition is TRUE) otherwise it does not equal that thing.
nothing is assigned to val until the evaluation is complete Theres scenarios... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 07:42 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
You are simply not reading what I'm writing.
Im converting the int only once, im testing that it is indeed and int the second go.
It says convert the int ONLY if it IS one. otherwise, move on with y... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 07:20 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
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... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 07:02 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
(May-05-2021, 06:22 PM)deanhystad Wrote: I do not understand your example, or the linked full example, at all.
A fallthrough statement transfers control to the next case. in this case, the else clau... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 06:34 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: RE: feature request: ternary fallthroughs
thanks, that an interesting library ive never heard of.
Fallthroughs exist in other languages, it just means to perform the next condition provided a criteria is met. Not sure if you looked at the fu... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 02:04 PM |
|
|
Thread: feature request: ternary fallthroughs
Post: feature request: ternary fallthroughs
I suspect theres a better way of doing things, but consider the following code:
def get_args():
if len(sys.argv) > 1:
val = int(sys.argv[1]) if int(sys.argv[1]) else fallthrough
e... |
|
rexrf |
News and Discussions |
31 |
8,886 |
May-05-2021, 12:57 PM |
|
|
Thread: Upgrade pip error
Post: RE: Upgrade pip error
did you install 3.9 from source? |
|
rexrf |
General Coding Help |
3 |
3,165 |
Oct-23-2020, 12:14 PM |
|
|
Thread: find file not knowing the extension
Post: RE: find file not knowing the extension
a quick fix would be to create a sub directory for both png and jpg, that way the path itself is the test
also, not sure how youre inserting / retrieving data from mongodb, but adding a "type" key va... |
|
rexrf |
General Coding Help |
6 |
3,130 |
Jul-07-2020, 01:44 PM |
|
|
Thread: Multiple Timers
Post: RE: Multiple Timers
assuming you want these timers to be non blocking? as in running one timer wont stop the program from continuing untill it has completed, and will instead happily run in the background.
if this is th... |
|
rexrf |
General Coding Help |
3 |
4,787 |
Jul-06-2020, 04:43 PM |
|
|
Thread: fileinput package appears to be zeroing files
Post: fileinput package appears to be zeroing files
trying to replace a string inline using fileinput package, but after being processed the resulting files are zero bytes... here is a snippet of code, if you need it all just ask :)
for i in files:
... |
|
rexrf |
General Coding Help |
0 |
1,479 |
Jul-01-2020, 06:05 PM |
|
|
Thread: Issues with character conversion
Post: Issues with character conversion
So I'm trying to learn python and I came up with an idea for a little program that reads a text file, converts all of the characters into pseudo-random ones, and then creates a key to return it to hum... |
|
rexrf |
General Coding Help |
0 |
2,273 |
Oct-13-2017, 02:03 PM |