Hammerite added the comment:

Here is an initial attempt at a patch that implements the new function.

Notes on this patch:

- The function as implemented here returns a string: "Yes", "No", or "Maybe". 
In light of the fact that Python now has enums, it is probably more appropriate 
that unicodedata contain an enum (QuickCheckValue, say) that has Yes, No and 
Maybe as values, and that the function return values from the enum. However, I 
do not know how to implement this in C and I do not know where I might look for 
an example of where something like this is done (in C) already in the CPython 
codebase, so I have not done that.

- My example code in the initial message on this issue was in error, as it 
assumed that the new function would return a Boolean value. In fact, there are 
three possible return values (Yes, No and Maybe), and corrected code would test 
the return value for equality with a string (as I have implemented the 
function) or for equality or identity with an enum value.

- When I first generated a patch, it was very long and consisted mostly of 
changes to three generated header files; these changes accounted for a total of 
about 60,000 lines' worth of patch file and appeared to be almost entirely 
spurious. Although one or more of these header files will genuinely be 
generated differently on account of my changes (a new string array 
_PyUnicode_QuickCheckNames is now present, along the same lines as the 
pre-existing 'Names' arrays), I have omitted them from the diff for being 
extremely bulky and for being generated code in any case.

----------
keywords: +patch
Added file: http://bugs.python.org/file38308/quick_check_x.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to