wtfpython icon indicating copy to clipboard operation
wtfpython copied to clipboard

tiny wtfs

Open droid192 opened this issue 4 years ago • 1 comments

  • when one grapheme becomes two unicodepoints, thus len(string) is two:

    len('g̈')
    'U+', hex(ord('g̈'[0])) #returns the first
    
  • despite added support for ordered dicts, the order does not matter when comparing:

    {'a': 20, 'b': 2} == {'b':2, 'a':20}
    
  • pow(4,-1, 3) == 4**-1 % 3

might be worth porting too: https://stackoverflow.com/questions/101268/hidden-features-of-python

droid192 avatar Oct 29 '20 14:10 droid192

Thanks for sharing these :)

The second one shows why using OrderedDict can still be useful in certain cases.

The third one actually throws an expception in Python 3.6, although it works fine with 3.8 or higher.

satwikkansal avatar Oct 29 '20 16:10 satwikkansal