On Fri, Nov 24, 2017 at 5:42 AM, Mikhail V <mikhail...@gmail.com> wrote: > Chris A wrote: > >>> On Fri, Nov 24, 2017 at 1:10 AM, Mikhail V wrote: >>> >>>> Chris A wrote: >>>> >>>> Fortunately for the world, you're not the one who decided which >>>> characters were permitted in Python identifiers. The ability to use >>>> non-English words for function/variable names is of huge value; the >>>> ability to use a hyphen is of some value, but not nearly as much. >>> >>> Fortunately for the world we have Chris A. Who knows what is >>> fortunate and of huge values. >>> So is there any real world projects example of usage of non-latin scripts >>> in identifiers? Or is it still only a plan for the new world? > > >> Yes, I've used them personally. And I know other people who have. > > > Oh, I though it would be more impressive showcase for 'huge value'. > If we drop the benefit of the bare fact that you can do it, or you just > don't know English, how would describe the practical benefit? > If you don't know english, then programming at all will be just too hard. > (or one must define a new whole language specially for some local script)
Let's start with a simpler question. Which of these is better code? # ====== Option 1 class ZipExhausted(Exception): pass def zip_longest(*args, **kwds): # zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D- fillvalue = kwds.get('fillvalue') counter = len(args) - 1 def sentinel(): nonlocal counter if not counter: raise ZipExhausted counter -= 1 yield fillvalue fillers = repeat(fillvalue) iterators = [chain(it, sentinel(), fillers) for it in args] try: while iterators: yield tuple(map(next, iterators)) except ZipExhausted: pass # ========= Option 2 class e(Exception): pass def zl(*a, **k): f = f.get('fillvalue') c = len(a) - 1 def s(): nonlocal c if not c: raise e c -= 1 yield f ff = repeat(f) i = [chain(i, s(), ff) for i in args] try: while i: yield tuple(map(next, i)) except e: pass # ======== One of them is cribbed straight from the itertools docs. The other is the same functionality with shorter variable names. What makes one of them better than the other? Answer me that, and I'll continue. ChrisA -- https://mail.python.org/mailman/listinfo/python-list