Python Forum
is there an unused character in Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there an unused character in Python?
#1
is there an unused character in Python? i'm looking for a character i won't see outside of quotes that i can drop into my code for some source processing that will end up being removed in the code output of that processing. something that can be in the code but will never exist in a double form would be an alternative. obviously i can't use double / for this, or even double *. but, maybe double % could be used, for example.

any ideas? maybe a ??
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
A dollar sign?
Skaperen likes this post
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
(Oct-22-2022, 08:05 AM)wavic Wrote: A dollar sign?
that would be usable for my processing. thank you! are you 100% sure there is no use of this character in Python source syntax (not counting inside any string)?

i have in a few cases mistyped # as $ (adjacent key on a US qwerty keyboard) and have always gotten a syntax error for it. and no, this processing is not for fixing typos.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
It can exist in a string obviously but I am 99.999 sure that Python doesn't use it at all. For now. Except in regular expressions. Perhaps that backtick " ` " too. But as I can see it is a deprecated usage instead of __repl__ in Python 2 according to that: https://stackoverflow.com/questions/1673...xample-num

I look at my keyboard now for all symbols and I am unable to see any other sign that is not used in Python's syntax.

If you are the only one that is going to use that code you could bind a key combination to a non-ascii symbol and use it instead. Some greek letter or even an emoji.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
(Oct-23-2022, 05:33 AM)wavic Wrote: I am unable to see any other sign that is not used in Python's syntax.
My keyboard has $ € ¨ … ° « » – ` that are not used in Python's syntax. Also innumerable other unicode characters are not used in Python's syntax, but they can appear in literal strings.
wavic likes this post
Reply
#6
i have been rethinking my development and early designs. Unicode certainly adds a lot of possibilities. a partial need if this idea is to be able t type this, manually. that would mean a limited scope of keyboards.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#7
Quote:that would mean a limited scope of keyboards.

Why don't you use dmenu, get from some source all characters you need, pipe them to dmenu and use it to copy one of them to the clipboard and paste it in your code.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#8
the limited scope of keyboards is for others to type something special. i personally have ways to get any of Unicode's 1114112 characters into my files, and even more than that.

i do like $ as most people know how to do that, as opposed to a grinning smiley face that does not appear on their keyboard.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#9
the $ would be typed by the coder along with some defined other stuff and end by a final $ to specify something to be done by processing the code. that stuff will be removed from the modified code. so, the output will have no $ unless the action specifies to do so (there will be a flag to repeat processing).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020