You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <da...@apache.org> on 2016/05/09 22:15:09 UTC

Re: svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/ subversion/tests/cmdline/svntest/ tools/client-side/ tools/server-side/svnpubsub/

stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
>  ######################################################################
> +# Permission constants used with e.g. chmod() and open().
> +# Define them here at a central location, so people aren't tempted to
> +# use octal literals which are not portable between Python 2 and 3.

For future reference, octal constants with leading "0o" work in both py2
and py3:

>>> 0o777   # works in py2 and py3
>>> 0777    # works in py2; syntax error in py3

Thanks for doing the py3 work!

RE: svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/ subversion/tests/cmdline/svntest/ tools/client-side/ tools/server-side/svnpubsub/

Posted by Markus Schaber <m....@codesys.com>.
Hi,

From: Stefan Fuhrmann [mailto:stefan2@apache.org]
> On 10.05.2016 00:15, Daniel Shahaf wrote:
> > stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> >>
> >> #####################################################################
> >> #
> >> +# Permission constants used with e.g. chmod() and open().
> >> +# Define them here at a central location, so people aren't tempted
> >> +to # use octal literals which are not portable between Python 2 and 3.
> > For future reference, octal constants with leading "0o" work in both
> > py2 and py3:
> >
> >>>> 0o777   # works in py2 and py3
> >>>> 0777    # works in py2; syntax error in py3
> Interesting. The online source that I found made it seem like there was no
> compatible way and suggested decimals.

According to the "official" source, the syntax was to be backported to Python 2.6:
https://www.python.org/dev/peps/pep-3127/

The changelist of Python 2.6 seems to agree:
https://docs.python.org/2/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax


> Anyway, using symbolic constants is certainly even better.

Throughout the code, yes, but even those could be defined in terms of octal literals. :-)

Best regards

Markus Schaber

CODESYS® a trademark of 3S-Smart Software Solutions GmbH

Inspiring Automation Solutions

3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50

E-Mail: m.schaber@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com
CODESYS forum: http://forum.codesys.com

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received
this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.

RE: svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/ subversion/tests/cmdline/svntest/ tools/client-side/ tools/server-side/svnpubsub/

Posted by Markus Schaber <m....@codesys.com>.
Hi,

From: Stefan Fuhrmann [mailto:stefan2@apache.org]
> On 10.05.2016 00:15, Daniel Shahaf wrote:
> > stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> >>
> >> #####################################################################
> >> #
> >> +# Permission constants used with e.g. chmod() and open().
> >> +# Define them here at a central location, so people aren't tempted
> >> +to # use octal literals which are not portable between Python 2 and 3.
> > For future reference, octal constants with leading "0o" work in both
> > py2 and py3:
> >
> >>>> 0o777   # works in py2 and py3
> >>>> 0777    # works in py2; syntax error in py3
> Interesting. The online source that I found made it seem like there was no
> compatible way and suggested decimals.

According to the "official" source, the syntax was to be backported to Python 2.6:
https://www.python.org/dev/peps/pep-3127/

The changelist of Python 2.6 seems to agree:
https://docs.python.org/2/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax


> Anyway, using symbolic constants is certainly even better.

Throughout the code, yes, but even those could be defined in terms of octal literals. :-)

Best regards

Markus Schaber

CODESYS® a trademark of 3S-Smart Software Solutions GmbH

Inspiring Automation Solutions

3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50

E-Mail: m.schaber@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com
CODESYS forum: http://forum.codesys.com

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received
this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.

Re: svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/ subversion/tests/cmdline/svntest/ tools/client-side/ tools/server-side/svnpubsub/

Posted by Stefan Fuhrmann <st...@apache.org>.
On 10.05.2016 00:15, Daniel Shahaf wrote:
> stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
>>   ######################################################################
>> +# Permission constants used with e.g. chmod() and open().
>> +# Define them here at a central location, so people aren't tempted to
>> +# use octal literals which are not portable between Python 2 and 3.
> For future reference, octal constants with leading "0o" work in both py2
> and py3:
>
>>>> 0o777   # works in py2 and py3
>>>> 0777    # works in py2; syntax error in py3
Interesting. The online source that I found made it seem
like there was no compatible way and suggested decimals.

Anyway, using symbolic constants is certainly even better.

-- Stefan^2.

Re: svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/ subversion/tests/cmdline/svntest/ tools/client-side/ tools/server-side/svnpubsub/

Posted by Stefan Fuhrmann <st...@apache.org>.
On 10.05.2016 00:15, Daniel Shahaf wrote:
> stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
>>   ######################################################################
>> +# Permission constants used with e.g. chmod() and open().
>> +# Define them here at a central location, so people aren't tempted to
>> +# use octal literals which are not portable between Python 2 and 3.
> For future reference, octal constants with leading "0o" work in both py2
> and py3:
>
>>>> 0o777   # works in py2 and py3
>>>> 0777    # works in py2; syntax error in py3
Interesting. The online source that I found made it seem
like there was no compatible way and suggested decimals.

Anyway, using symbolic constants is certainly even better.

-- Stefan^2.