On 10/7/2011 7:13 PM, Terry Reedy wrote:
> On 10/7/2011 10:06 AM, Nick Coghlan wrote:
>> FWIW, I don't mind whether it's "< 0" or "== -1", so long as there's a
>> comparison there to kick my brain out of Python boolean logic mode.
>
> Is there any speed difference (on common x86/64 processors and
On 10/7/2011 10:06 AM, Nick Coghlan wrote:
On Fri, Oct 7, 2011 at 9:21 AM, "Martin v. Löwis" wrote:
> if (!PyUnicode_READY(foo)) is not better, also because of
PyUnicode_IS_READY(foo).
I prefer PyUnicode_IS_READY(foo)< 0 over PyUnicode_IS_READY(foo) == -1.
Ok, so feel free to replace
On Fri, Oct 7, 2011 at 9:21 AM, "Martin v. Löwis" wrote:
> > if (!PyUnicode_READY(foo)) is not better, also because of
>>
>> PyUnicode_IS_READY(foo).
>>
>> I prefer PyUnicode_IS_READY(foo) < 0 over PyUnicode_IS_READY(foo) == -1.
>>
>
> Ok, so feel free to replace all == -1 tests with < 0 tests as
> if (!PyUnicode_READY(foo)) is not better, also because of
PyUnicode_IS_READY(foo).
I prefer PyUnicode_IS_READY(foo) < 0 over PyUnicode_IS_READY(foo) == -1.
Ok, so feel free to replace all == -1 tests with < 0 tests as well.
I'll point out that the test for -1 is also widespread in Python,
Le 07/10/2011 10:07, Stefan Krah a écrit :
Victor Stinner wrote:
Yes, I wrote if (PyUnicode_READY(foo)), but I agree that it is confusing
when you read the code, especially because we have also a
PyUnicode_IS_READY(foo) macro!
if (!PyUnicode_READY(foo)) is not better, also because of
PyUnicode
Victor Stinner wrote:
> Yes, I wrote if (PyUnicode_READY(foo)), but I agree that it is confusing
> when you read the code, especially because we have also a
> PyUnicode_IS_READY(foo) macro!
>
> if (!PyUnicode_READY(foo)) is not better, also because of
> PyUnicode_IS_READY(foo).
>
> I prefer
Le 07/10/2011 00:20, "Martin v. Löwis" a écrit :
Am 06.10.11 14:57, schrieb Amaury Forgeot d'Arc:
Hi,
with the new Unicode API, there are many checks like:
+ if (PyUnicode_READY(*filename))
+ goto handle_error;
I think you are misinterpreting what you are seeing.
There are not *many* such che
Benjamin Peterson wrote:
Why not just have it return 0 on error? This would be more consistent with API
functions that return "false" values like NULL
But that would make it confusingly different from all the other
functions that return ints. The NULL convention is only used
when the function
Am 06.10.11 14:57, schrieb Amaury Forgeot d'Arc:
Hi,
with the new Unicode API, there are many checks like:
+if (PyUnicode_READY(*filename))
+goto handle_error;
I think you are misinterpreting what you are seeing.
There are not *many* such checks. Of the PyUnicode_READY
chec
2011/10/6 Benjamin Peterson :
> Why not just have it return 0 on error? This would be more consistent with API
> functions that return "false" values like NULL and would just be
>
> if (!PyUnicode_READY(s)) return NULL;
Most functions of the Python C API seems to follow one of two ways to
indicate
On Thu, 6 Oct 2011 17:40:20 -0400
Nick Coghlan wrote:
> On Thu, Oct 6, 2011 at 4:47 PM, Benjamin Peterson wrote:
> > Amaury Forgeot d'Arc gmail.com> writes:
> >
> >> I'd prefer it was written :
> >> if (PyUnicode_READY(*filename) < 0)
> >> because "< 0" clearly indicates an error conditio
On Thu, Oct 6, 2011 at 4:47 PM, Benjamin Peterson wrote:
> Amaury Forgeot d'Arc gmail.com> writes:
>
>> I'd prefer it was written :
>> if (PyUnicode_READY(*filename) < 0)
>> because "< 0" clearly indicates an error condition.
>
> Why not just have it return 0 on error? This would be more c
Amaury Forgeot d'Arc gmail.com> writes:
> I'd prefer it was written :
>if (PyUnicode_READY(*filename) < 0)
> because "< 0" clearly indicates an error condition.
Why not just have it return 0 on error? This would be more consistent with API
functions that return "false" values like NULL a
On Thu, Oct 6, 2011 at 10:31 AM, Ronald Oussoren wrote:
> On 6 Oct, 2011, at 14:57, Amaury Forgeot d'Arc wrote:
>> I'd prefer it was written :
>> if (PyUnicode_READY(*filename) < 0)
>> because "< 0" clearly indicates an error condition.
>> That's how all calls to PyType_Ready are written, fo
On 6 Oct, 2011, at 14:57, Amaury Forgeot d'Arc wrote:
> Hi,
>
> with the new Unicode API, there are many checks like:
> +if (PyUnicode_READY(*filename))
> +goto handle_error;
>
> Every time I read it, I get it wrong:
> "If filename is ready, then fail"
> then I have to rem
Hi,
with the new Unicode API, there are many checks like:
+if (PyUnicode_READY(*filename))
+goto handle_error;
Every time I read it, I get it wrong:
"If filename is ready, then fail"
then I have to remember that the function returns either 0 or -1.
I'd prefer it was writte
16 matches
Mail list logo