4 ms·
afaik the only thing on python 3.7 that is backwards incompatible to 3.5 is: > async and await are now reserved keywords. so unless the author is using async/
by fernandotakai 8y ago
afaik the only thing on python 3.7 that is backwards incompatible to 3.5 is:
> async and await are now reserved keywords.
so unless the author is using async/await as variable names (and i wonder why they would), 3.5 code is going to run as expected.
- mahoro 8y ago> and i wonder why they would It's easy, actually: import asyncio @asyncio.async # SyntaxError in 3.7 def my_coroutine(...): ... And since asyncio is one of the strongest reason to migrate to python 3.x, I bet far less than 99.99% of code written for 3.4/3.5 can be run on 3.7 with no changes. Luckly, 99% of changes were trivial. Other 1% is a nightmare.
- blattimwind 8y agoUsing async and await as non-keywords was deprecated since 3.5, while asyncio.async was deprecated since 3.4.
- paulie_a 8y agoI wouldn't be surprised, I've seen a developer use type as a function name and it was imported everywhere...it caused a lot of problems. Not to mention the function literally did nothing, it essentially returned none under 99 percent of circumstances. If the person that wrote that was still at the company, that should have been a fire able offense.
- misnome 8y agoThe ‘deprecated’ warning on invalid escape strings turned into a hard error, also.
- chasedehan 8y agoThere is also formatted string literals from 3.5 to 3.6. 3.5 won't run if you included them in your 3.6 code
- mixmastamyk 8y agoThat's forward compatibility which few folks require. Backwards, yes most do.
- OJFord 8y ago> unless the author is using async/await as variable names (and i wonder why they would) Kubernetes-cli did, [0] inadvertently due to code generated by Swagger. [1] That doesn't mean only that project either - it means anything _depending_ (not necessarily directly!) on it is also broken under 3.7. [2] [0]: https://github.com/kubernetes-client/python/issues/558 https://github.com/kubernetes-client/python/issues/558 [1]: https://github.com/swagger-api/swagger-codegen/pull/8401 https://github.com/swagger-api/swagger-codegen/pull/8401 [2]: It bit me.
- ubernostrum 8y agoThere is one other thing that could break, but it would be a weird one. Which is hard to explain in prose, so here's some example code: class SomeMetaClass: def __new__(name, bases, attrs): pass class SomeClass(metaclass=SomeMetaClass): pass Now suppose that SomeClass needs to use the typing module's mechanism for indicating a generic, so you could do an annotation like "SomeClass[SomeOtherType]". So you'd want to have SomeClass be a subclass of, typing.Generic[T]. That would, in Python 3 prior to 3.7, raise a TypeError due to metaclass conflict -- the generics in the typing module had their own base metaclasses. So you actually had to define an intermediate class to resolve the metaclass conflict, and do like so: class IntermediateMeta(SomeMetaClass, typing.GenericMeta): pass class SomeClass(metaclass=IntermediateMeta): pass (this was weird and rare and GenericMeta was never documented) Python 3.7 implemented PEP 560, which introduced the __class_getitem__ hook for implementing the behavior GenericMeta used to handle, and doing away with the need for the typing generics to use GenericMeta as their metaclass. So GenericMeta exists in Python 3.5 and 3.6, but no longer exists in Python 3.7, and anything which tries to reference it will break.