Re: [openstack-dev] [all] Thoughts on python-future?

2015-11-25 Thread Eric Kao
I think the main benefit of python-future is that the library helps us
write straight Python 3 code instead of special bridged code.

For example, instead of writing six.iteritems(dict0), one could write
simply dict0.items() and expect Python 3 behavior across Python 2 & 3.
This way, whenever Python 2 support is dropped, we can easily drop the
dependence on the library just by dropping the import statements, because
the library mostly had no effect in Python 3 in the first place.

But as others have pointed out, the downside is that the library mucks
with the Python 2 internals, apparently causing much grief =(

On 11/24/15, 7:05 PM, "Robert Collins" <robe...@robertcollins.net> wrote:

>Which bit in particular do you like? Some of the stuff - like
>past.translation - is likely to be deeply fragile, other bits are
>fine, but not really any different to six.
>
>On 25 November 2015 at 15:33, Eric Kao <ekcs.openst...@gmail.com> wrote:
>> Hi all,
>>
>> I¹ve been using the python-future library for Python 3 porting and want
>>to
>> see what people think of it.
>>http://python-future.org/overview.html#features
>>
>> The end result is standard Python3 code made compatible with Python2
>>through
>> library imports. The great thing is that Python 3 execution is mostly
>> independent of the library, so once Python 2 support is dropped, the
>>use of
>> the library can be dropped too.
>>
>> Anyone know why it¹s not used in OpenStack perhaps alongside six?
>>Thanks!
>>
>> 
>>_
>>_
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: 
>>openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>
>
>-- 
>Robert Collins <rbtcoll...@hp.com>
>Distinguished Technologist
>HP Converged Cloud
>
>__
>OpenStack Development Mailing List (not for usage questions)
>Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [all] Thoughts on python-future?

2015-11-25 Thread Eric Kao
Thanks for sharing your thoughts and experiences everyone!

It’s really too bad that the library causes all this headache. The goal is
laudable: enable Python 3 code to run on Python 2 with minimal
modification. It’d be really nice to write clean, standard Python 3 code
[e.g., dict0.items() ] rather than special, bridged code [e.g.,
six.iteritems(dict0) ] for Python 2+3 compatibility.

Such is life I guess. The goal inevitably requires messing with Python 2
internals to conform to Python 3 behavior, which inevitably leads to the
issues people mentioned.

Thanks again!

On 11/25/15, 10:10 AM, "Joshua Harlow" <harlo...@fastmail.com> wrote:

>Julien Danjou wrote:
>> On Tue, Nov 24 2015, Eric Kao wrote:
>>
>>> I¹ve been using the python-future library for Python 3 porting and
>>>want to
>>> see what people think of it.
>>>http://python-future.org/overview.html#features
>>>
>>> The end result is standard Python3 code made compatible with Python2
>>>through
>>> library imports. The great thing is that Python 3 execution is mostly
>>> independent of the library, so once Python 2 support is dropped, the
>>>use of
>>> the library can be dropped too.
>>>
>>> Anyone know why it¹s not used in OpenStack perhaps alongside six?
>>>Thanks!
>>
>> python-future has been a dependency of pytimeparse¹ for a while and it
>> has been a nightmare. IIRC, python-future blends into Python magically
>> so it is somehow automatically imported each time you run Python. This
>> had a tendency to break random other Python packages installed in the
>> environment.
>
>Oh, please no then, magically messing with other python packages by
>monkeying with the internals of python we already have enough of (cough
>cough eventlet, cough cough parts of jsonutils in oslo.serialization
>that injects itself into anyjson)...
>
>Just say no to more please ;)
>
>>
>> In the end we just dropped it from pytimeparse and we're much happier.
>>
>> And we're very happy with six. :)
>>
>> ¹  It's used by Gnocchi.
>>
>>
>> 
>>_
>>_
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: 
>>openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [all] Thoughts on python-future?

2015-11-24 Thread Eric Kao
Hi all, 

I¹ve been using the python-future library for Python 3 porting and want to
see what people think of it. http://python-future.org/overview.html#features

The end result is standard Python3 code made compatible with Python2 through
library imports. The great thing is that Python 3 execution is mostly
independent of the library, so once Python 2 support is dropped, the use of
the library can be dropped too.

Anyone know why it¹s not used in OpenStack perhaps alongside six? Thanks!


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev