The goal as it stands is to make PyObject an opaque type (interpreted to
mean, "incomplete type"), but there is a blocking problem to
accomplishing that.
Functions/Macros like PY_TYPE require a complete PyObject.
There is 3 ways we can solve this problem:
1) Dump to & export from the Python DLL.
- This will created performance overhead that can scale worse and
worse the more they're used.
2) Dump to a static library.
- This has a toss up on saving performance or sharing #1's …
[View More]problem
depending on the compiler and options used.
3) Dump to precompiled headers.
- My limited understanding of precompiled headers suggests we can
eliminate the need of LTCG, but compilers CAN impose restrictions on their
usage (MSVC for sure has restrictions).
What would be the best approach to go with? Ultimately, the end result
should have roughly the same performance rating as current non limited code.
[View Less]
This will be helpful for python linters, own data types, etc.
Example:
class SQL_String(str):
@property
def __chr__(self): # SQL_string.__chr__ will return string that need to be before string start
return 's'
def __check__(self): # This method will be called by intepreter to check if string is OK
if not str(self).endswith(';'): # For example, we want to make that this string always needed to ends with ";"
raise SyntaxError('Missing ";" …
[View More]at the end of string')
else:
return True
my_sql_string = s'SELECT * FROM information_schema.tables' # SyntaxError
my_sql_string_2 = s'SELECT * FROM information_schema.tables;' # all is ok
[View Less]
Proposal:
Allow standard python escapes inside curly braces in f-strings.
Main point is to make clear visual distinction between text and
escaped chars:
# current syntax:
print ("\nnewline")
print ("\x0aa")
# new syntax:
print (f"{\n}newline")
print (f"{\x0a}a")
Currently it is SyntaxError:
"SyntaxError: f-string expression part cannot include a backslash"
Further, I suggest hex code escapes with a new prefix "\ ", i.e.
backslash+space,
(this would work in f-…
[View More]strings only obviously) so it could be used
instead current
variants: \\x, \\u, and \\U without need to include all leading zeros in codes.
Consecutive codes can be simply separated by space.
Example:
# current syntax:
print ("\x48\x65\x6c\x6c\x6f\U0001F601") # Hello and a smiley
print ("\x0aa")
# new syntax:
print (f"{\ 48 65 6c 6c 6f 01F601}")
print (f"{\ 0a}a")
And I personally would like to see an option for decimal charcodes,
e.g. with "\." prefix using the same schema as above with hex codes.
Mikhail
[View Less]