Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 998313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:10:26+00:00 2026-05-16T07:10:26+00:00

I’ve noticed that I can not use all unicode characters in my python source

  • 0

I’ve noticed that I can not use all unicode characters in my python source code.

While

def 价(何):

is perfectly allright (albeit nonsensical [probably?]),

def N(N₀, t, λ) -> 'N(t)':

this isn’t allowed (the subscript zero that is).

I also can’t use some other characters, most of which I recognise as something other than letters (mathematical operators for example). I always thought that if I just stick to the rules I know, i.e. composing names from letters and numbers, with a letter as the first character, all will be okay. Now, the subscript zero is clearly a ‘number’. so my impression was wrong.

I know I should avoid using special characters. However, the function definition above (the exponential decay one that is) seems to me perfectly reasonable – because it will never change, and it so elegantly conveys all the information needed for another programmer to use it.

My question therefore, exactly which characters are allowed and which aren’t? And where?

Edit
All right I seem not to have been clear enough. I am using python3, so there is no need for declaring the encoding of the source file. Apparent I thought from then fact that my Chinese function definition works.

My question concerns why some characters are allowed there, while others aren’t.
The subscript zero raises an error, invalid character in identifier, but the blackboard bold zero works. Both equally special I’d say.

I’d like to know if there are any general rules that apply not just to my situation, there must be. It seems that my error is not an accident.

Edit 2:

The answer courtesy of Beau Martínez, pointing me to the language reference, where i should have looked in the first place:

http://www.dcl.hpi.uni-potsdam.de/home/loewis/table-3131.html
It appears the characters that are allowed are all chosen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:10:27+00:00Added an answer on May 16, 2026 at 7:10 am

    As per the language reference, Python 3 allows a large variety of characters as identifiers.

    That zero subscript character seems like a number, but it isn’t for Python; Python only treats 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 as numbers. It is in fact a character, so you can use it as an identifier (it’s as if it were, instead, for example, a greek character such as Phi).

    Importantly, how easily can you type those characters with your keyboard? I don’t want to pull up the character map every time I have to call your functions, for example. Calling it “maximum_decay_rate” or something much more intuitive to any user, not just a Physics major, makes your code more readable.

    If you say it isn’t allowed, it’s probably because you haven’t specified the character encoding for your source file. It can be specified by having # -*- coding: utf-8 -*- (or which ever the encoding) at the beginning of your source file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.