If you are going to add a new case function somewhere in the middle of a REPL 
session because order matters, maybe break it with anything like write a number 
or something.. and then repeat the case functions with the order you wish. Now 
the new case functions will overwrite whatever you wrote before.. We can make a 
rule that the case functions should be below each other. I’ve always seen the 
different functions done above each other in Haskell. 

> On 8 Aug 2021, at 5:10 PM, 2qdxy4rzwzuui...@potatochowder.com wrote:
> 
> Because the order of cases is significant, these would be difficult to
> work with in the REPL.  If, for example, I start with your three
> definitions, and then decide to write a special case¹ for 2, how do I
> convince Python that
> 
>    case def fib(2):
>          return 1
> 
> belongs before the general case?
> 
> ¹ Yeah, I know, special cases aren't special enough.  In a non-toy case
> (pun intended), there could be any number of reasons to add a new case
> in the middle, or to redfine/fix a case that already exists rather than
> add a new case to the end.

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/REES6S3RED7FYQRE7A4J753V7VZBI7VA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to