Cheryl Sabella <chek...@gmail.com> added the comment:

I also timed this for a `_tran` optimization (instead of looping and doing the 
`ord`), but it didn't really make a difference.
```
_tran = defaultdict(lambda: 'x')
_tran.update({40: 40,    # ord('(')
              91: 40,    # ord('[')
              123: 40,   # ord('{')
              41: 41,    # ord(')')
              93: 41,    # ord(']')
              125: 41,   # ord('}')
              34: 34,    # ord('"')
              39: 39,    # ord("'")
              92: 92,    # ord("\\")
              10: 10,    # ord("\n")
              35: 35,    # ord("#")
              })
```
I think both the loop and the above mapping are equally difficult to understand 
without stopping to think about it.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32880>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to