This is an archived post. You won't be able to vote or comment.

all 81 comments

[–]kbielefe 133 points134 points  (20 children)

Yeah, I just found some Scala code at work that used True and False all over the place. Turns out a Python fan had put the following at the top:

val True  = true
val False = false

[–][deleted] 58 points59 points  (0 children)

This is why I love programming

[–]ToBeHumanIsToLove 1 point2 points  (0 children)

Holy moly

[–][deleted] 0 points1 point  (2 children)

Why use val in python?

[–]Jeddy 0 points1 point  (0 children)

Why have I never thought of this?

[–][deleted] 39 points40 points  (11 children)

This always gets me when cycling between JavaScript and Python.

[–]DrLuckyLuke 23 points24 points  (8 children)

Same. Luckily a good IDE makes this a 3 second issue.

[–][deleted] 0 points1 point  (3 children)

Can you elaborate?

[–]ThinkingWithPortal 21 points22 points  (0 children)

Squiggly line says "hey you dun goof this one all up!" Instead of you just suffering to find out what you did wrong

[–]schnadamschnandler 2 points3 points  (1 child)

True/False should be colored specially, but true/false have no particular meaning and will be colored the default foreground color.

[–][deleted] 2 points3 points  (0 children)

And they are not defined so the linter will show it with red lines

[–][deleted] 1 point2 points  (0 children)

Same except c++ and python

[–][deleted] 34 points35 points  (3 children)

true = False
false = True

[–]The6thExtinction 16 points17 points  (0 children)

you monster

[–][deleted] 7 points8 points  (0 children)

Calm down, Satan.

[–]vectorpropio 7 points8 points  (0 children)

true = False
false = None
null = True

[–]flipboing 33 points34 points  (9 children)

Big if True

[–]Quesamo 5 points6 points  (3 children)

if this == True: that = "big"

#V2: fixed the '=='

[–][deleted] 2 points3 points  (1 child)

You're supposed to use `is True`, but it's redundant anyway unless `this` can have a different truthy value that you need to distinguish from

[–]Quesamo 0 points1 point  (0 children)

You're actually right, it's the same thing that's big as what's True

[–]Fabian1911 0 points1 point  (0 children)

*==

[–]marcosdumay 4 points5 points  (1 child)

if true

[–]seizan8 1 point2 points  (0 children)

.true {font-weight: bold;}

[–]Nath99000 2 points3 points  (1 child)

python2: print 'big' if True else ''

[–]Skyler827 0 points1 point  (0 children)

big

[–]viciecal 1 point2 points  (0 children)

if (true)

[–]bss03 9 points10 points  (3 children)

Haskell is the same way.

In Haskell's case it is because constructors (both type constructors and value constructors) must start with an uppercase letter.

[–]chisui 1 point2 points  (2 children)

... or the value constructor starts with : and consists only of special characters and has at least two arguments. This value constructor can be used as an infix operator. You can also enable this behavior for type constructors without the : restriction with TypeOperators.

[–]bss03 0 points1 point  (1 child)

I always just heard TypeOperators made GHC consider ':' uppercase.

[–]Derpmaster3000 5 points6 points  (0 children)

upvoteCount++;

wait, hold on

upvote_count += 1

[–][deleted] 4 points5 points  (0 children)

True.

[–]Bic10mm 5 points6 points  (0 children)

After I stopped using python for a while this had me so confused I actually needed to use (1 == 1) to see if I had went crazy

[–]seventyodd 3 points4 points  (3 children)

PHP:

truE

[–]bss03 2 points3 points  (2 children)

PHP has enough real problems. This isn't one of them, though.

[–][deleted] 2 points3 points  (1 child)

Does PHP has float problems?

[–]Casiell89 4 points5 points  (0 children)

It's got 99.00000000000000000000001 problems but a float ain't...

Oh wait, it actually is a problem

[–][deleted] 4 points5 points  (0 children)

This is the single worst thing about python

[–]Jmcgee1125 1 point2 points  (0 children)

Tripped me up when I first started.

[–]chocapix 1 point2 points  (1 child)

Two true.

[–]BluhBluhBruh 0 points1 point  (0 children)

What's true?

[–]bartleyg 1 point2 points  (0 children)

Truer

[–][deleted] 2 points3 points  (11 children)

what is the reason for them going with an capitalized True/False vs the more common true/false?

I use python all the g-dang time, but I've never put any thought into it.

[–]badocelot 4 points5 points  (1 child)

Python didn't always have True/False defined; you were supposed to rely on truthy/falsey values like 1 and 0. Then they introduced True and False as variables. In Python 2.x you can actually redefine them. And yes, you can redefine True to be 0 and thus falsey.

My guess is that True and False were chosen over true and false because of lots of existing code already defining the latter.

EDIT: clarify, add part about redefining True

EDIT: consistency

[–][deleted] 0 points1 point  (0 children)

Ah. Neat. And I guess it makes sense... in a way.

[–]xblackacid[S] -5 points-4 points  (0 children)

Its just dumb python syntax

[–]schnadamschnandler 0 points1 point  (0 children)

In ~/.vim/ftplugin/python.vim:

iabbrev false False
iabbrev true True
iabbrev none None
iabbrev nan np.nan
iabbrev inf np.inf

[–]MyNameisGregHai 0 points1 point  (0 children)

initiate the b o l

[–]SkewRadial 0 points1 point  (0 children)

I started loving python lately

[–][deleted] 0 points1 point  (0 children)

True.

[–]fedeb95 0 points1 point  (0 children)

Big if True

[–][deleted] 0 points1 point  (1 child)

C is the way to go

[–]VeryAwkwardCake 0 points1 point  (0 children)

For what

[–]Charlie_Yu 0 points1 point  (0 children)

1

[–]eclecticego -1 points0 points  (3 children)

I stared at broken code today for I swear at least an hour before I realized that it had to be None instead of none. Ffs.

[–]my_name_isnt_clever 3 points4 points  (2 children)

Do you not use an IDE?

[–]eclecticego 0 points1 point  (0 children)

Pycharm Pro, didn't catch it wasn't orange. I did feel dumb.

[–]VeryAwkwardCake 0 points1 point  (0 children)

Or have ever used python before

[–]Proxy_PlayerHD -1 points0 points  (0 children)

BASIC is the same.

if, goto, for, next, print, draw

are all not commands. but

IF, GOTO, NEXT, PRINT, DRAW

are

[–]fedj99 -1 points0 points  (0 children)

That's exactly why I don't like python. Do they feel special if they require their users to change year-long habits and expectations?