slott56,
@slott56@fosstodon.org avatar

#python

Hadn't thought this before. But.

>>> a = 2  
>>> a′ = a + 1  
 File "<stdin>", line 1  
 a′ = a + 1  
 ^  
SyntaxError: invalid character '′' (U+2032)  

The Unicode Prime (and Double Prime) should be valid parts of an identifier. Maybe a few others that are widely-used.

>>> a² = a ** 2  
 File "<stdin>", line 1  
 a² = a ** 2  
 ^  
SyntaxError: invalid character '²' (U+00B2)  
numeredevs,
@numeredevs@fosstodon.org avatar

@slott56 Don't think so. Will break ABI compatibility with C and C++ identifiers. Although ABI stability is kind of a foreign word for the Python guys.

mrblissett,
@mrblissett@mastodon.social avatar

@slott56
How does one type 0-9 superscript...

cohomologyisFUN,
@cohomologyisFUN@mastodon.sdf.org avatar

@mrblissett @slott56 it depends on your OS or terminal emulator, but there’s typically a way to enter any character if you know the Unicode code point (U+00B2).

https://en.wikipedia.org/wiki/Unicode_input

Many times, I just copy-and-paste.

mrblissett,
@mrblissett@mastodon.social avatar

@cohomologyisFUN @slott56
My point is:
** is faster to remember type than any unicode input method.
No lookups, no Alt+ codes, no editor keyboard shortcut, no copying from a map.

Use * twice, be done, and move on!

cohomologyisFUN,
@cohomologyisFUN@mastodon.sdf.org avatar

@mrblissett @slott56 sorry, I was dense and failed to recognize your question as rhetorical 😀🤦🏽‍♂️

I agree, but I think OP’s point was to see which characters are allowed (or not) in identifiers

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • ngwrru68w68
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • GTA5RPClips
  • Youngstown
  • everett
  • slotface
  • rosin
  • osvaldo12
  • mdbf
  • kavyap
  • cubers
  • megavids
  • modclub
  • normalnudes
  • tester
  • khanakhh
  • Durango
  • ethstaker
  • tacticalgear
  • Leos
  • provamag3
  • anitta
  • cisconetworking
  • JUstTest
  • lostlight
  • All magazines