A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-October/113915.html below:

[Python-Dev] check for PyUnicode_READY look backwards

[Python-Dev] check for PyUnicode_READY look backwardsNick Coghlan ncoghlan at gmail.com
Thu Oct 6 23:40:20 CEST 2011
On Thu, Oct 6, 2011 at 4:47 PM, Benjamin Peterson <benjamin at python.org> wrote:
> Amaury Forgeot d'Arc <amauryfa <at> 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 and would just be
>
> if (!PyUnicode_READY(s)) return NULL;
>
> in code.

Alas, that isn't the convention in C - courtesy of Unix, the
convention is that for integer return codes, "0" means success. Yes,
this is annoying, but violating it means you're not writing idiomatic
C any more, you're trying to write Python-in-C.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4