You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Malcolm Rowe <ma...@farside.org.uk> on 2007/05/03 09:25:33 UTC

Re: svn commit: r24909 - branches/ctypes-python-bindings/csvn/core

On Wed, May 02, 2007 at 09:52:57PM -0700, glasser@tigris.org wrote:
> ==============================================================================
> --- branches/ctypes-python-bindings/csvn/core/__init__.py	(original)
> +++ branches/ctypes-python-bindings/csvn/core/__init__.py	Wed May  2 21:52:57 2007
> @@ -6,6 +6,9 @@
>  from csvn.ext.listmixin import ListMixin
>  import sys
>  
> +TRUE=1
> +FALSE=0
> +

I'm curious: how do these differ from Python (2.5's) True and False?
Are we expecting that people will use TRUE and FALSE in their code, or
are they just an implementation detail?

Regards,
Malcolm

Re: svn commit: r24909 - branches/ctypes-python-bindings/csvn/core

Posted by David Glasser <gl...@mit.edu>.
On 5/3/07, Malcolm Rowe <ma...@farside.org.uk> wrote:
> On Wed, May 02, 2007 at 09:52:57PM -0700, glasser@tigris.org wrote:
> > ==============================================================================
> > --- branches/ctypes-python-bindings/csvn/core/__init__.py     (original)
> > +++ branches/ctypes-python-bindings/csvn/core/__init__.py     Wed May  2 21:52:57 2007
> > @@ -6,6 +6,9 @@
> >  from csvn.ext.listmixin import ListMixin
> >  import sys
> >
> > +TRUE=1
> > +FALSE=0
> > +
>
> I'm curious: how do these differ from Python (2.5's) True and False?
> Are we expecting that people will use TRUE and FALSE in their code, or
> are they just an implementation detail?

These simulate Subversion's svn_boolean_t values TRUE and FALSE; David
used them in User.setup_auth_baton to call svn_cmd_setup_auth_baton.

I don't know ctypes well enough to know if there's a way to make it
automatically convert between Python booleans and svn_boolean_t.

--dave

-- 
David Glasser | glasser@mit.edu | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r24909 - branches/ctypes-python-bindings/csvn/core

Posted by David James <ja...@cs.toronto.edu>.
On 5/3/07, Malcolm Rowe <ma...@farside.org.uk> wrote:
> I'm curious: how do these differ from Python (2.5's) True and False?
> Are we expecting that people will use TRUE and FALSE in their code, or
> are they just an implementation detail?

They don't differ -- TRUE and FALSE are exactly the same as Python's
underlying 'True' and 'False'. You can actually use them
interchangeably. ctypes will convert 'True' into 1 and 'False' into 0
automatically.

ctypesgen only exports defines to Python if they are defined in a
Subversion header file. 'TRUE' and 'FALSE' are only defined in a
Subversion header file if they aren't defined by a system header. As a
result, TRUE and FALSE are only exported to Python on some platforms.
To fix this, David added a definition for these constants into
__init__.py.

I don't care whether users use 'TRUE' or 'True' in their code. I do
think that users should be able to use 'TRUE' in their code because
the Subversion API docs mention this constant. Alternatively, some
users may wish to use 'True' because this is the standard Python
syntax for boolean truth. Either way is fine with me, so we let users
use either syntax.

Cheers,

David

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org