
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
49 lines
1.2 KiB
Plaintext
49 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Importing a feature from the ``++__future__++`` module turns on that feature from a future version of Python in your module. The purpose is to allow you to gradually transition to the new features or incompatible changes in future language versions, rather than having to make the entire jump at once.
|
|
|
|
|
|
Because such changes must be applied to the entirety of a module to work, putting such imports anywhere but in the beginning of the module doesn't make sense. It would mean applying those restrictions to only part of your code. Because that would lead to inconsistencies and massive confusion, it's not allowed.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
name = "John"
|
|
|
|
from __future__ import division # Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
from __future__ import division
|
|
|
|
name = "John"
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Move this "__future__" import to the top of the module.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 29 Apr 2015, 07:09:00 Ann Campbell wrote:
|
|
I've edited your edits [~elena.vilchik]. Double-check me, please
|
|
|
|
endif::env-github,rspecator-view[]
|