497
submitted 1 week ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 11 points 1 week ago

In Python you can use this as a variable name

[-] [email protected] 9 points 1 week ago* (last edited 1 week ago)

In Python you can use ๐Ÿ† as a variable name.

Edit: oops, guess I was mistaken, you can use most Unicode but emojis are not valid.

[-] [email protected] 10 points 1 week ago

Just going by the reputation, you probably can do this in JavaScript

[-] [email protected] 4 points 1 week ago
~ $ python
Python 3.12.10 (main, Apr  9 2025, 18:13:11) [Clang 18.0.3 (https://android.googlesource.com/toolchain/llvm-project d8003a456 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> โ— = 'nah'
  File "<stdin>", line 1
    โ— = 'nah'
    ^
SyntaxError: invalid character 'โ—' (U+2757)
>>>
~ $ node
Welcome to Node.js v23.11.1.
Type ".help" for more information.
> const ๐Ÿ‘ = 'test'
const ๐Ÿ‘ = 'test'
      ^

Uncaught SyntaxError: Invalid or unexpected token
>
[-] [email protected] 9 points 1 week ago

Edit: oops, guess I was mistaken, you can use most Unicode but emojis are not valid.

That actually seems even more arbitrary. Like, do they just hate fun?

[-] [email protected] 5 points 1 week ago

you might be thinking of Rust.

[-] [email protected] 4 points 1 week ago
[-] [email protected] 4 points 1 week ago

The source character set is implementation defined.

[-] [email protected] 4 points 1 week ago

You can use anything that doesn't start with a digit or punctuation as a variable name (underscore beginning also allowed) unless it's a keyword.

[-] [email protected] 3 points 1 week ago* (last edited 1 week ago)

_ (sic) as a variable name is often used when a function returns multiple outputs but you only want one

 def my_function:
      return 1, 2, 3

 _, two, _ = my_function()
[-] [email protected] 1 points 6 days ago

_ can also be used in the python interactive terminal to mean 'last return value'

Ie:

> 'string'
'string'
> a = _
> print(a)
string
[-] [email protected] 5 points 1 week ago

Underscore alone is a special variable name and I'm pretty sure anything assigned to it goes straight to garbage collection. Whereas _myvariable is typically use to indicate a "private" class variable or method (Python doesn't have private so it's just a convention).

this post was submitted on 08 Jun 2025
497 points (97.7% liked)

Programmer Humor

36533 readers
210 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS