Live data from Hacker News

We have an employee whose last name is Null. He kills our employee lookup (2012)

stackoverflow.com

21–30 of 245 posts

Re: We have an employee whose last name is Null. He kills our employee lookup (2012)

#21
post #5

Earlier quoted context omitted.

Ditto for Python (int 0 at least).

Weird, because makes a distinction between int and string.

Python makes a distinction between types, but it has a concept of falsyness (as do many languages, though it is often more restricted e.g. in Ruby only false and nil are falsy IIRC).

Falsyness is used in boolean-ish contexts (if, while and explicit boolean conversion), by default all of None (null), False, 0, 0.0, "" (the empty string, unicode or binary) and empty collections ([], (), {}, set()) are falsy and although UDTs are "truthy" it can be overridden.

This has nothing to do with making the distinction between ints and strings. You could actually implement the same thing in e.g. Haskell (by creating a "Booleanish" typeclass and implementing it on all the types you care for).

edit: please note that — in Python — 0 (the integer) is falsy but "0" (the string containing a single character 0x30) is truthy. I expect gtaylor talks about bugs in handling of IDs or sequence numbers and the like, not usernames. I know I've hit them when not being very attentive.

Re: We have an employee whose last name is Null. He kills our employee lookup (2012)

#22
post #6

Reminds me of a story a police reservist told me. Guy got a license plate caled "none," and instantly had thousands of outstanding warrants. (The cop thought "none" was trying a fast one, and so deserved it.)

Second only to Mr Prawo Jazdy: http://news.bbc.co.uk/2/hi/7899171.stm

Re: We have an employee whose last name is Null. He kills our employee lookup (2012)

#23

COALESCE(LASTNAME, ''), how hard is that?

That's a nonsensical suggestion, the guy's name is the string "Null" which is munged by some intermediate system, if you're looking for Mr Null you don't want to get people with empty names back.

Re: We have an employee whose last name is Null. He kills our employee lookup (2012)

#24
post #5
post #2

Numerous bugs on github were attributed to the guy with user name 0. He evaluates to false in many PHP applications, too.

Ditto for Python (int 0 at least).

Yeah, but "0" is True. Why would you store a name as an int?

Re: We have an employee whose last name is Null. He kills our employee lookup (2012)

#25
post #5
post #2

Numerous bugs on github were attributed to the guy with user name 0. He evaluates to false in many PHP applications, too.

Ditto for Python (int 0 at least).

In python 0 is falsy. "0" is not.
Post reply on HN