10 ms·
Sometimes I feel weird coding zip codes as strings but this is a great example why. If my program ever treats a zip code like a number I would like it to throw
by _edo 7y ago
Sometimes I feel weird coding zip codes as strings but this is a great example why. If my program ever treats a zip code like a number I would like it to throw an error. At least in this case the error looks like an accident.
On topic, from yesterday: https://news.ycombinator.com/item?id=21067764 https://news.ycombinator.com/item?id=21067764
It's another social sciences paper but in this case a co-author has requested a retraction over his strong belief that the paper includes fabricated data. The retraction request has been denied. It differs from this paper in that the data anomalies look intentional.
- crooked-v 7y agoNon-US postal codes often include letters and spaces, and some areas don't use postal codes at all.
- jedberg 7y agoAll US postal codes have an optional - (hyphen) in them as well, and so you should always encode them as strings anyway.
- haasted 7y agoMy rule of thumb is that anything that’s not part of a calculation will be a string. Any chance I ever want to multiply a zip code? Doubtful. String, it is.
- ars 7y ago> If my program ever treats a zip code like a number I would like it to throw an error. One interesting thing you can do though, is sort by zipcode. This sorts your mail from East to West in the US. You can use that as a rough estimate of shipping time.
- LorenPechtel 7y agoSo? You make sure the zip code is left zero filled and the strings sort fine. Admittedly, numbers would sort a bit faster.
- _edo 7y agoThat's really cool, even if I never find a place to use it. Anyway you can still sort strings.