[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur that this should be closed.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

At least some idlelib imports are delayed to avoid circular import errors, as 
described by Nick.

The patch adds 'Module level' before 'imports'.
Pro: techinically correct as only module level imports can be put at the top.
Com: might be seen as giving too much license to putting imports elsewhere.

Raymond, what do you think?  If you are not 'pro' enough to make the change, I 
think we should close.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Since this is a PEP related issue, it should be moved to the PEP Github 
repository here : https://github.com/python/peps . If it still exists.

--
nosy: +nanjekyejoannah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2016-06-02 Thread Ian Lee

Ian Lee added the comment:

Are there any other concerns with the patch that I would be able to clean up?

--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2016-02-19 Thread Pas

Changes by Pas :


--
nosy: +pas

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 I would argue this is a good time to clean up that code in the standard 
 library.

Please leave any clean-ups to the module maintainers.  PEP 8 is something you 
should do to your own code, rather than something you inflict on other people's 
code.

We generally leave clean-ups to the module maintainers rather than creating 
code churn which can make it more difficult to apply actual bug fixes across 
versions.

Also, GvR has long expressed a preference for holistic refactoring where we 
avoid making superficial changes across the library and reserve those changes 
for occasions where we're thinking more deeply about a specific piece of code.  
The basis for this viewpoint has been confirmed a number of times when we've 
received Pep 8 patches that introduced bugs into code that was previously 
correct.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ian Lee

Ian Lee added the comment:

So one concern that was brought up on GitHub was the fact that currently this 
is not actually followed universally in the Python standard library. In 
particular there are 636 errors in the standard library ``python pep8.py 
--select E402 --statistics /usr/lib/python3.4``.

The vast majority are due to issues with dunder definitions 
``__{all,author,copyright,credits,version,etc...}__`` before the imports. A 
lesser cause is imports in the middle of files. ``Lib/tokenize.py`` has pretty 
much all of these issues. In particular ``__all__`` is specifically mentioned 
that it should be declared AFTER the imports by PEP-8. That said, I would argue 
this is a good time to clean up that code in the standard library.

Additionally, its possible that there might need to be some wording in the PEP 
about intermixing try,except,else,finally and possibly if,elif,else into 
the imports. E.g. 

```
try: 
import unittest2
except:
import unittest
```

```
if sys.platform == 'win32':
import foo
```

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ian Lee

Ian Lee added the comment:

I should add that I would be happy to patch the standard libraries to be 
compliant w.r.t. the imports at top of the files.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I read Nick's post and I would like PEP8 to continue to discourage imports at 
class scope unless there is actually a use case.  I discovered yesterday that 
idlelib.ColorDelegator has several imports at the top of the module and more as 
the top of the class (of the same name).  I cannot think of any good reason for 
the split.

--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-15 Thread Ian Lee

New submission from Ian Lee:

Minor update pep8 to specify explicitly that Imports at top of file refers 
specifically to module level imports, per input from Nick Coghlan @ 
https://github.com/jcrocholl/pep8/pull/304#issuecomment-66939162

--
assignee: docs@python
components: Documentation
files: pep-0008.patch
keywords: patch
messages: 232708
nosy: IanLee1521, docs@python, ncoghlan
priority: normal
severity: normal
status: open
title: Update pep8 to specify explicitly 'module level' imports at top of file
type: enhancement
Added file: http://bugs.python.org/file37459/pep-0008.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23061
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com