On Apr 4, 2014 3:51 AM, "Marko Rauhamaa" <ma...@pacujo.net> wrote: > > >>> switch day casein ("Monday", "Thursday", "Wednesday", "Tuesday", > >>> "Friday"): > >>> gotowork = True > >>> continue > >>> casein ("Monday", "Thursday", "Wednesday", "Tuesday", "Friday"): > >>> daytype = "ferial" > >>> casein ("Saturday", "Sunday") > >>> daytype = "festive" > > That "casein" next to "switch" bugs me. Did I already propose: > > switch: local_sabbath() > case (1, 2, 3) as sabbath: > ... > case 6: > ... > else: > ...
I don't get what this is intended to do. First, why is the expression in the first line after the colon? That doesn't match any existing block syntax (as you note it matches lambda, but that's an expression-level syntax). What's wrong with the much more natural "switch local_sabbath():"? Second, "as" clauses are used in other contexts for local assignment. What is the purpose of doing that here? How does this solve the problem of explicitly denoting case multiplicity?
-- https://mail.python.org/mailman/listinfo/python-list