[issue47184] multiprocessing.set_start_method force argument is not documented
New submission from John Hagen : multiprocessing.set_start_method() has a `force` argument that is not documented: https://docs.python.org/3.10/library/multiprocessing.html#multiprocessing.set_start_method -- assignee: docs@python components: Documentation messages: 416451 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: multiprocessing.set_start_method force argument is not documented type: enhancement versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue47184> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43834] Use context manager in StringIO example
Change by John Hagen : -- keywords: +patch pull_requests: +24133 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25401 ___ Python tracker <https://bugs.python.org/issue43834> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43834] Use context manager in StringIO example
New submission from John Hagen : The example for StringIO currently manually closes the object rather than using a context manager. Since this is likely the first code that a new user encounters and context managers reduce error-prone situations, I think it would be helpful to show usage as a context manager. https://docs.python.org/3/library/io.html#io.StringIO.getvalue Something like: import io with io.StringIO() as output: output.write('First line.\n') print('Second line.', file=output) # Retrieve file contents -- this will be # 'First line.\nSecond line.\n' contents = output.getvalue() # Context manager will automatically close # object and discard memory buffer -- # .getvalue() will now raise an exception. -- assignee: docs@python components: Documentation messages: 391000 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Use context manager in StringIO example type: enhancement versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue43834> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34556] Add --upgrade-deps to venv module
John Hagen added the comment: I noticed this new feature was not added to the Python 3.9 what's new: https://docs.python.org/3.9/whatsnew/3.9.html#venv Should it be? -- nosy: +John Hagen ___ Python tracker <https://bugs.python.org/issue34556> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
John Hagen added the comment: With PEP 594 (https://www.python.org/dev/peps/pep-0594/) in the pipeline, is it time that optparse correctly emits DeprecationWarnings? -- ___ Python tracker <https://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36309] Remove tempfile.mktemp()
John Hagen added the comment: Should it be a DeprecationWarning instead of a RuntimeWarning? (or both since it's both deprecated and a security issue?) -- ___ Python tracker <https://bugs.python.org/issue36309> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36309] Remove tempfile.mktemp()
New submission from John Hagen : tempfile.mktemp has been deprecated since Python 2.3 and has security concerns attached to it. Is it time that this is finally removed? https://docs.python.org/3/library/tempfile.html#tempfile.mktemp -- components: Library (Lib) messages: 338046 nosy: John Hagen priority: normal severity: normal status: open title: Remove tempfile.mktemp() type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue36309> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33921] Explain that '' can be used to bind to all interfaces for the AF_INET address family in the docs
John Hagen added the comment: @ammar2 I see that now. Yeah it's further down in the docs and doesn't actually call out '' like is done for AF_CAN: A tuple (interface, ) is used for the AF_CAN address family, where interface is a string representing a network interface name like 'can0'. The network interface name '' can be used to receive packets from all network interfaces of this family. Ideally I think putting something in this section would be helpful: A pair (host, port) is used for the AF_INET address family, where host is a string representing either a hostname in Internet domain notation like 'daring.cwi.nl' or an IPv4 address like '100.50.200.5', and port is an integer. -- ___ Python tracker <https://bugs.python.org/issue33921> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33921] Explain that '' can be used to bind to all interfaces for the AF_INET address family in the docs
New submission from John Hagen : The socket documentation (https://docs.python.org/3/library/socket.html#socket-families) does not list '' as a way to bind to all interfaces for the AF_INET/AF_INET6 address family. This is answered on SO here: https://stackoverflow.com/a/8034146 but it took me a while to find it. Ideally if this was mentioned in the docs, that would be great. -- assignee: docs@python components: Documentation messages: 320125 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Explain that '' can be used to bind to all interfaces for the AF_INET address family in the docs type: enhancement versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue33921> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29621] telnetlib.Telnet.write gives confusing error message when a string is passed in
New submission from John Hagen: I was recently helping someone learn Python 3 from Python 2 and they were confused by error resulting from the following easy-to-make mistake: import telnetlib tn = telnetlib.Telnet('localhost') tn.write('hello') Traceback (most recent call last): File "/Users/user/PycharmProjects/python-test/main.py", line 4, in tn.write('hello') File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/telnetlib.py", line 287, in write if IAC in buffer: TypeError: 'in ' requires string as left operand, not bytes What is confusing is that the solution is to pass in `bytes`, not a `str`, but the place where this manifests is in an `in` operator with the first argument as a `bytes` (telnetlib.IAC). Perhaps a simple isinstance(buffer, bytes) could be used to throw a `TypeError` or something a bit more helpful. It also doesn't help that for some reason Googling "python telnet" only seems to bring up the Python 2 docs link, rather than Python 3 or both. -- components: Library (Lib) messages: 288371 nosy: John Hagen priority: normal severity: normal status: open title: telnetlib.Telnet.write gives confusing error message when a string is passed in type: enhancement versions: Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29621> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29130] Exit code 120 returned from Python unit test testing SystemExit
John Hagen added the comment: I'm completely fine with closing this issue. Thanks for the help everyone. If someone else doesn't close it in a couple days, I'll do it. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29130> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29130] Exit code 120 returned from Python unit test testing SystemExit
New submission from John Hagen: I recently tried to port one of my packages to Python 3.6 and unit tests that worked in Python 2.7, 3.3-3.5 began failing in 3.6. I originally thought it was a problem with coverage, but it turns out it was not. The full thread is: https://bitbucket.org/ned/coveragepy/issues/545/coverage-fails-on-python-36-travis-build The highlight is this unit test causes Python to exit with status code 120 (which fails a Travis build): class ParseArgumentsTestCase(unittest.TestCase): def test_no_arguments(self): # type: () -> None with self.assertRaises(SystemExit): # Suppress argparse stderr. class NullWriter: def write(self, s): # type: (str) -> None pass sys.stderr = NullWriter() parse_arguments() Ned found this corresponding note in the Python 3.6 release notes: Changed in version 3.6: If an error occurs in the cleanup after the Python interpreter has caught SystemExit (such as an error flushing buffered data in the standard streams), the exit status is changed to 120. If this is indeed, correct behavior and Python 3.6 is catching something incorrect (I agree this is not necessarily the most elegant unit test) then I am happy to close this issue. Just wanted to be sure I at least reported it in case this was a real issue. -- components: IO messages: 284437 nosy: John Hagen priority: normal severity: normal status: open title: Exit code 120 returned from Python unit test testing SystemExit type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29130> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28886] Deprecated abstract base class (abc) decorators do not raise DeprecationWarning
New submission from John Hagen: In the abc module (https://docs.python.org/3/library/abc.html) the following decorators have been deprecated since Python 3.3: - abstractclassmethod - abstractstaticmethod - abstractproperty But if you run the following example code using Python 3.5.2 with -Werror, no DeprecationWarnings are thrown. Throwing DeprecationWarnings will help make it more clear that these properties should not be used. PyCharm, for example, will strikethrough the usage of methods that throw DeprecationWarning so that even new users will be notified quickly even if they don't run with -Werror. import abc class Base(abc.ABC): @abc.abstractclassmethod def abstract_class(cls): pass @abc.abstractstaticmethod def abstract_static(): pass @abc.abstractproperty def abstract_property(self): pass class Child(Base): @classmethod def abstract_class(cls): print('Abstract class method') @staticmethod def abstract_static(): print('Abstract static method') @property def abstract_property(self): return 'Abstract property' child = Child() child.abstract_class() child.abstract_static() print(child.abstract_property) -- components: Library (Lib) messages: 282548 nosy: John Hagen priority: normal severity: normal status: open title: Deprecated abstract base class (abc) decorators do not raise DeprecationWarning type: behavior versions: Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28886> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27877] Add recipe for "valueless" Enums to docs
John Hagen added the comment: Emanuel, I like your rewording. Uploaded a new patch incorporating it. -- Added file: https://bugs.python.org/file44252/issue27877.johnthagen.02.patch ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27877] Add recipe for "valueless" Enums to docs
Changes by John Hagen <johntha...@gmail.com>: Removed file: https://bugs.python.org/file44249/issue27877.johnthagen.01.patch ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27877] Add recipe for "valueless" Enums to docs
John Hagen added the comment: Patch attached. -- keywords: +patch Added file: https://bugs.python.org/file44249/issue27877.johnthagen.01.patch ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27877] Add recipe for "valueless" Enums to docs
John Hagen added the comment: Raymond, thanks for your consideration and input. I'll work on a small patch unless I hear from Ethan that he'd rather do it. I'm happy to defer to his expertise. I did try out None as a value just to be sure that that didn't work as it would not be a bad alternative. But since the values are "equal", Enum tries to alias them. import enum @enum.unique class Color(enum.Enum): red = None green = None blue = None >>> ValueError: duplicate values found in : green -> red, blue -> >>> red -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27877] Add recipe for "valueless" Enums to docs
New submission from John Hagen: Many programming languages allow the developer to define a enum without specifying values when there would be no significance to those values. Adding some kind of support in the stdlib itself was rejected due to the high degree of magic that would be needed: https://bugs.python.org/issue26988 I propose that a simple example be added to the enum docs that show a developer how to use a normal Python Enum to create this most common and basic enum (without values). import enum class Color(enum.Enum): red = object() green = object() blue = object() object() returns a new unique value while conveying that that value should not be expected to be used in any meaningful way (unlike an integer value, which could be used to encode the Enum in some way). There is no extra magic going on here, no new code that needs to be added to the stdlib, and no bare identifiers that could confuse linters. For example, PyCharm already fully understands the above example and statically types it. This example also allows the developer to omit the extra @enum.unique() boilerplate that is normally needed, since he or she cannot accidentally use the same integer value twice. -- assignee: docs@python components: Documentation messages: 273780 nosy: John Hagen, barry, docs@python, eli.bendersky, ethan.furman priority: normal severity: normal status: open title: Add recipe for "valueless" Enums to docs type: enhancement versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: Ethan, thank you so much for all of your work. Looking forward to any future collaboration. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: @Raymond, you raise valid concerns to be sure. Hoping we can work something out. @Ethan, what are your thoughts? It's not just C that has enums where you can define a unique group of names and omit the values for clarity when they are not significant: C++: http://en.cppreference.com/w/cpp/language/enum C#: https://msdn.microsoft.com/en-us/library/sbbt4032.aspx Java: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html Rust: https://doc.rust-lang.org/book/enums.html In my experience this is the most common and simple use case for enums. Raymond, what are your thoughts about the version of AutoEnum that requires that a bare tuple be used as the value. It has been in the Python docs since 3.4 and was actually the original request of this issue: https://docs.python.org/library/enum.html#autonumber It avoids many of the concerns that you've raised while still providing a way to create Enums in the normal class declaration method users would expect with a minimum amount of boilerplate. Note that normally you want to use @enum.unique with a normal Enum, but AutoEnum also allows you to omit that boilerplate as you can't accidentally alias the values. @enum.unique class Color(enum.Enum): aquamarine = 1 blue = 2 fushia = 3 # inserting a member here (perhaps because it's clearest to keep these in alphabetic order) # results in having to increment all following members ... green = 40 red = 41 vs. class Color(enum.AutoEnum): aquamarine = () blue = () fushia = () # inserting a member here (perhaps because it's clearest to keep these in alphabetic order) # results in no refactoring ... (30+ more) green = () red = () A big advantage of the class based Enums compared to the functional API is that you can clearly document an Enum and its members in way Sphinx can take advantage of and developers would be used to. # Assuming tuple assignment version for this example. class ClientOperationMode(enum.AutoEnum): """Modes of operations of the network client.""" push = () """The client pushes data to the server automatically.""" pull = () """The client pulls commands from the server.""" hybrid = () """The client both pushes data and pulls for commands from the server.""" Sphinx will document this AutoEnum like a normal class, pulling in the class docstring, and attribute docstrings. I don't see an obvious way to do this in the functional API docs: https://docs.python.org/library/enum.html#functional-api -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: I think there is a small typo in the Changelog / What's New. The Issue isn't hyper-linked: https://docs.python.org/3.6/whatsnew/changelog.html#id2 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: @Ethan I reviewed your latest patch. I think it's a good step forward in terms of simplicity. Most of my comments were not major. Even before this patch, I was mulling around how enum.Unique, enum.UniqueEnum, and enum.unique seemed to violate the "There should be one obvious way to do it" principle, so I like that you omitted those in the latest patch. Looks good to me, thanks for all of your work! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
John Hagen added the comment: The patch was reviewed and marked ready to commit. Could someone with commit privileges perform the final commit? Thanks. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: I like the addition of UniqueEnum. It's the default use case often. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: >class BaseZeroEnum(Enum, start=0): > "initial integer is 0" > ... I also think this looks better. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: To me, class Color(AutoEnum) and class Color(AutoEnum, IntEnum) is a little more straightforward. It makes usage of AutoEnum similar to IntEnum, and I would expect it to be at least as popular as it. A enum-related side question, since the plan is for this to go into the stdlib, would it also go into enum34 since that is the official back port of the stdlib Enum? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: Some ideas for the new stdlib class: BasicEnum - This helps emphasize that it is a simpler version of Enum that doesn't support all of the Enum features (like assigning values). It also helps communicate that if you don't need values this is a better fit. AutoEnum - This new version (compared with AutoNumberEnum in the docs) does more than just auto number, since it does even the value assignment. Auto helps communicate that this is automatically creating much of the class internals for you. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: > What happens with `property`? > > - `property` is looked up in the class namespace Perhaps you've already considered this, I'm not intimately familiar with how classes are parsed and constructed but is it possible to determine if the object is a decorator? It already determines to stop auto-numbering when it hits the first method, could it stop when it hits the first decorator or method? Being able to use temporaries is an interesting side effect, but I feel like that would be used less often than a @staticmethod, @property, or @classmethod over a method, in which case it becomes a little more complex. That being said, I think either solution is valid. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: Is this something we want to get in before the next alpha in two days? Just wanted to bring up the deadline since this may be a feature people want to play around with during the alpha phase. Ethan, I'm happy to help with documentation or anything else. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
John Hagen added the comment: @Berker, thanks for the tip! I've fixed it up. I think this latest patch covers everything Berker and Terry have commented about. -- Added file: http://bugs.python.org/file43645/Fix-tkinter-docs-PEP8.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
Changes by John Hagen <johntha...@gmail.com>: Removed file: http://bugs.python.org/file43641/0001-Fix-tkinter-docs-PEP8.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
John Hagen added the comment: @Terry I've removed the two string quotes changes in the latest patch. @Berker I spent a small amount of time trying out your proposed super() changes, but could not get them to work on 3.5.1. "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\python.exe" "C:/Users/John Hagen/PycharmProjects/test/test.py" Traceback (most recent call last): File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 25, in app = Application(master=root) File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 6, in __init__ super().__init__(self, master) File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2583, in __init__ Widget.__init__(self, master, 'frame', cnf, {}, extra) File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2131, in __init__ BaseWidget._setup(self, master, cnf) File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2109, in _setup self.tk = master.tk AttributeError: 'Application' object has no attribute 'tk' import tkinter as tk class Application(tk.Frame): def __init__(self, master=None): super().__init__(self, master) self.pack() self.create_widgets() def create_widgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Hello World\n(click me)" self.hi_there["command"] = self.say_hi self.hi_there.pack(side="top") self.quit = tk.Button(self, text="QUIT", fg="red", command=root.destroy) self.quit.pack(side="bottom") def say_hi(self): print("hi there, everyone!") root = tk.Tk() app = Application(master=root) app.mainloop() -- Added file: http://bugs.python.org/file43641/0001-Fix-tkinter-docs-PEP8.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
Changes by John Hagen <johntha...@gmail.com>: Removed file: http://bugs.python.org/file43628/0001-Fix-tkinter-docs-PEP8.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
John Hagen added the comment: @Terry The reason for changing the quotes was for consistency, since everywhere else on that page used double quotes. That being said, I don't have a strong preference and will happily revert it if that is the consensus. I'm +0 on the change. I personally use single quotes everywhere and use flake8-quotes to help with this. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
John Hagen added the comment: @Berker, sorry for the incorrect diff format, still new to CPython (and Mercurial) workflow. I've attached the diff in a new format. @SilentGhost I see what you mean that camelCase is used often in tkinter (though many of the examples use lower_camel_case, so it seems like at least it's not consistent currently). The minor issue I was trying to fix with this patch is that I was showing a programmer completely new to Python the tkinter example and when he pasted it into PyCharm it had some PEP8 warnings, so I was hoping to improve that experience slightly for others in the future. Some of the changes were newlines for PEP8, would those be accepted? I'm not strongly inclined either way, so if the core team thinks it should not be changed, I'm happy with that. -- Added file: http://bugs.python.org/file43628/0001-Fix-tkinter-docs-PEP8.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
Changes by John Hagen <johntha...@gmail.com>: Removed file: http://bugs.python.org/file43627/0001-Fix-tkinter-docs-PEP8.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27455] Fix tkinter examples to be PEP8 compliant
New submission from John Hagen: Patch fixes tkinter examples to be PEP8 compliant. -- assignee: docs@python components: Documentation files: 0001-Fix-tkinter-docs-PEP8.patch keywords: patch messages: 269820 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Fix tkinter examples to be PEP8 compliant versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43627/0001-Fix-tkinter-docs-PEP8.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: @Ethan/Barry what needs to be done now to accept or reject this for Python 3.6? Should I propose it onto python-dev? If accepted, would be nice to get it in before alpha 3 (~2 weeks). What's nice about this proposal is Ethan has already written the code, so it's just a matter of getting consensus to add it. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27311] Incorrect documentation for zipfile.writestr()
John Hagen added the comment: Patch attached. -- keywords: +patch Added file: http://bugs.python.org/file43395/0001-Fix-ZipFile.writestr-data-argument-name.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27311> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27311] Incorrect documentation for zipfile.writestr()
John Hagen added the comment: I'll submit a patch shortly. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27311> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27311] Incorrect documentation for zipfile.writestr()
New submission from John Hagen: The function signature and description for zipfile.writestr is incorrect: https://docs.python.org/3.5/library/zipfile.html#zipfile.ZipFile.writestr See: https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1610 The documentation calls the parameter 'bytes', but the real parameter name is 'data'. Looks like this was not fixed when the source changed to Python 3: https://github.com/python/cpython/blob/2.7/Lib/zipfile.py#L1208 -- assignee: docs@python components: Documentation messages: 268490 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Incorrect documentation for zipfile.writestr() versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27311> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
John Hagen added the comment: @Ethan, I hadn't tried to use the aenum AutoNumberEnum that way, but I agree with Barry that I like it. To me that is the ideal case we should shoot for as I think it's the best* long term and deviate only if practical concerns prevent it. So I am +1 for empty member assignment and if that is rejected, +1 for = () assignment as at least it is a big step forward. I feel both solutions already have some "magic", so would lean toward the one that leads to the least amount of boilerplate. As for the empty assignment, I have played around with something similar before and will throw out one con for it: static analyzers get really confused. PyCharm, for example, thinks this is has unresolved references in it: class Color(AutoNumberEnum): red green blue But the counter point is that if this is in the stdlib, static analyzer authors are much more likely to add a special case for it than if in a "non-official" third party package (PyCharm example: https://youtrack.jetbrains.com/issue/PY-19150). Another piece of evidence to support inclusion is that Python already provides specialized Enum subclasses (like IntEnum). I've written a lot of Python code that uses Enums and haven't personally needed IntEnum yet, but would have used an AutoEnum many, many times. * I am assuming here that a true "enum" keyword is out of the question at this point for Python, which would probably be even better. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26988] Add AutoNumberedEnum to stdlib
New submission from John Hagen: I suggest that the AutoNumberedEnum be added to the standard library for the following reasons: 1) Provides a fundamental tool for defining a unique, abstract set of coupled members 2) Avoids boilerplate @enum.unique for a very common use case of enumerations 3) The code already exists in the Python documentation, so it has been vetted at some level The AutoNumberedEnum also allows the developer to make a clearer distinction between enumerations whose values have special meaning and those that do not. Consider: @enum.unique class Color(enum.Enum): red = 1 blue = 2 green = 3 @enum.unique class Shape(enum.Enum): """Member values denote number of sides.""" circle = 1 triangle = 3 square = 4 With AutoNumberedEnum it's possible to better express the intent that the value of Color members does not hold special meaning, while Shape members do: class Color(enum.AutoNumberedEnum): red = () blue = () green = () @enum.unique class Shape(enum.Enum): """Member values denote number of sides.""" circle = 1 triangle = 3 square = 4 For enumerations with many members (10s), there becomes a maintenance issue when inserting new enumerations into the list: @enum.unique class Color(enum.Enum): aquamarine = 1 blue = 2 fushia = 3 # inserting a member here (perhaps because it's clearest to keep these in alphabetic order) # results in having to increment all following members ... green = 40 red = 41 Most other languages have support for naming enumerations without explicitly declaring their values (albeit with specialized syntax that makes it cleaner): C++: http://en.cppreference.com/w/cpp/language/enum C#: https://msdn.microsoft.com/en-us/library/sbbt4032.aspx Java: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html Rust: https://doc.rust-lang.org/book/enums.html Currently, a developer can copy the code from the Python docs into his or her project, or add a dependency on aenum. I would argue that it belongs in the standard library. If there are objections to it being too magical, I would argue it's already spelled out in the docs, so it's being prescribed as a solution already. I think it should be very clear when you derive from "AutoNumberedEnum" what is going on. The code is very simple, so I would hope maintenance would not be difficult. -- components: Library (Lib) messages: 265214 nosy: John Hagen, ethan.furman priority: normal severity: normal status: open title: Add AutoNumberedEnum to stdlib type: enhancement versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
John Hagen added the comment: With 3.6.0a1 scheduled just around the corner, is there consensus about how to begin this? I just signed the contributor agreement, so I should be able to try to help if we have a plan on how to divide the work. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26149] Suggest PyCharm Community as an editor for Unix platforms
New submission from John Hagen: The Python documentation recommends editors that can be used on Unix: https://docs.python.org/3.5/using/unix.html#editors If the intent is to advertise very excellent IDEs (as Geany and Komodo Edit are listed), I suggest that PyCharm Community Edition (https://www.jetbrains.com/pycharm/download/) be added to the list. It is free, has a very powerful static analyzer, comes with PEP8 checking installed by default, supports type hinting, ... (https://www.jetbrains.com/pycharm/features/) -- assignee: docs@python components: Documentation messages: 258551 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Suggest PyCharm Community as an editor for Unix platforms type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26149> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
John Hagen added the comment: Is there any consensus on how to move forward with this? I feel there are at least 4 options: 1) Do nothing. Pro: No work. Con: It feels misleading to the user since the docs clearly state it's deprecated. Some users (especially new ones) may miss the fact they should really be using argparse. 2) Throw PendingDeprecationWarning from optparse, and simply suppress it where it's used. Pro: Not as much work. Users of optparse are properly notified. Con: Kicks the can down the road for someone else to have to eventually port off of optparse. 3) Throw PendingDeprecationWarning from optparse and port stdlib modules to argparse. Pro: Seems like the "purest" solution at least from what is indicated in docs that it will no longer be supported. Users of optparse are properly notified. Con: Most amount of work. argparse has some bugs that need to be patched. 4) Some combination of 2) and 3) where some modules are suppressed and others are ported. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
John Hagen added the comment: @martin.panter My new patch fixes Lib/test_optparse.py by suppressing the warning like test_imp does as you suggested. @serhiy.storchaka I don't have a strong preference that it be a DeprecationWarning vs. PendingDeprecationWarning since to me, both get the point across to the end-user to avoid it. I do, however, feel that it is important raise some kind of warning since it seems clear from the docs that is deprecated. In my new patch I changed the type of warning to a PendingDeprecationWarning, as there seems to be at least some notion that optparse is a special case. I don't have a strong opinion about which type of deprecation warning is used. My new patch works when test_optparse.py is run with -Werror on 3.6.0a0. -- Added file: http://bugs.python.org/file40921/optparse_and_test_deprecationwarning.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
Changes by John Hagen <johntha...@gmail.com>: Removed file: http://bugs.python.org/file40913/optparse_deprecationwarning.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
John Hagen added the comment: First time trying to contribute to the Python standard library. I attached a patch that is modeled off the deprecated imp module. The DeprecationWarning message is taken from the Python docs: https://docs.python.org/3/library/optparse.html -- keywords: +patch Added file: http://bugs.python.org/file40913/optparse_deprecationwarning.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25521] optparse module does not emit DeprecationWarning
New submission from John Hagen: According to the Python docs, optparse has been deprecated since Python 3.2, but it does not emit a DeprecationWarning when imported Python 3.2+. https://docs.python.org/3/library/optparse.html PyCharm can uses these DeprecationWarnings to provide helpful alerts the user: https://youtrack.jetbrains.com/issue/PY-16589 -- components: Library (Lib) messages: 253768 nosy: John Hagen priority: normal severity: normal status: open title: optparse module does not emit DeprecationWarning type: behavior versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25521> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24852] Python 3.5.0rc1 HOWTO Use Python in the web needs fix
John Hagen added the comment: A couple other notes I saw: The examples (https://docs.python.org/3.5/howto/webservers.html#setting-up-fastcgi) do not follow PEP 8 (should not have an encoding statement if it is UTF-8 Python 3) or the current guidance in PEP 394 to use python3 in the shebang rather than python. Unfortunately, I think I should defer writing the patch/new page to someone with more experience in the Python/web world. I am still pretty new to it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24852 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24852] Python 3.5.0rc1 HOWTO Use Python in the web needs fix
New submission from John Hagen: https://docs.python.org/3.5/howto/webservers.html#setting-up-fastcgi The HOWTO Use Python in the web documentation for 3.5.0rc1 prescribes to use flup in its example, which is not compatible with Python 3. This has led to some confusion: https://stackoverflow.com/questions/23482357/fastcgi-wsgi-library-in-python-3 Perhaps the whole article could be given a once over to ensure it is still the best advice as of 2015. -- assignee: docs@python components: Documentation messages: 248491 nosy: John Hagen, docs@python priority: normal severity: normal status: open title: Python 3.5.0rc1 HOWTO Use Python in the web needs fix type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24852 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com