Hacker News new | past | comments | ask | show | jobs | submit login

Every Python program should be tested with Emoji characters, they're a real torture test.



Note that you need to test on every platform, as the default file encoding may vary. I missed that bug in part because it worked correctly on Linux.


Good point. I do almost all of my Python on Windows where it's much easier to get an error.


Every program in general should be tested with Emoji characters at this point.


Not a bad idea, but I think Python is more likely to have hidden bugs that this will uncover. A language that accepts bytes as input and emits the same on output will probably work fine on UTF-8 for example.


That's the Python 2 mentality and a large part of this discussion was that it didn't work in hindsight, that you can't just be "encoding oblivious", but it usually doesn't show up as an obvious problem until you least expect it. Our input and output devices are aren't always homozygous on byte encoding (and quite possibly very rarely are; we have decades and decades of kludges around this), and testing every program with Emoji has become one of my favorite pastimes for finding failure cases.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: