Re: [Python-Dev] Positional-only parameters in Python
Hi, On Wed, Jan 17, 2018 at 8:04 PM, Victor Stinner wrote: > Hi, > > In Februrary 2017, I proposed on python-ideas to change the Python > syntax to allow to declare positional-only parameters in Python: > > https://mail.python.org/pipermail/python-ideas/2017-February/044879.html > https://mail.python.org/pipermail/python-ideas/2017-March/044956.html > > There are already supported at the C level, but not at the Python level. > > Our BDFL approved the idea: > > https://mail.python.org/pipermail/python-ideas/2017-March/044959.html > > But I didn't find time to implement it. Does someone want to work on > an implementation of the idea? > > March 2, 2017 7:16 PM, "Brett Cannon" wrote: >> It seems all the core devs who have commented on this are in the positive >> (Victor, Yury, Ethan, Yury, Guido, Terry, and Steven; MAL didn't explicitly >> vote). So to me that suggests there's enough support to warrant writing a >> PEP. Are you up for writing it, Victor, or is someone else going to write >> it? > > It seems like a PEP is needed. I followed the threads mentioned above, which led me to PEP 457: https://www.python.org/dev/peps/pep-0457/ I didn't find a clear indication if it was still to be modified, approved or rejected. Can anyone help? Also, on a second note, I can help with writing a PEP (would prefer co-authoring with someone ), but this would be my first time and I would really appreciate guidance of core-developers. -- Mozilla Rep http://www.SanyamKhurana.com Github: CuriousLearner ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Issue 32933
Hey Tony, You can raise a PR and then start working on writing a test case of it. People would then be able to see what exactly you've done and suggest changes if need be. Let me know if you've any more questions. On Sat, Mar 3, 2018 at 11:24 PM, TonyFlury via Python-Dev wrote: > I mentioned when I raised issue 32933 (mock_open doesn't support dunder iter > protocol) that I have a one line fix for the issue. > > Who should I send this detail too ? Obviously it will need test cases too - > I wrote a single very simple one just to prove to myself it worked - but it > isn't complete by any stretch of the imagination. > > -- > Anthony Flury > anthony.fl...@btinternet.com > > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/sanyam.khurana01%40gmail.com > -- Mozilla Rep http://www.SanyamKhurana.com Github: CuriousLearner ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Refactor __get_builtin_constructor on hasklib.py
Hello, Welcome to the mailing list Park! On Tue, Aug 7, 2018 at 12:30 PM, 蔡銘峯 wrote: > Hello everybody, > I am Park Tsai. I want to refactor __get_builtin_constructor on hasklib.py > of python 2.7 > (https://github.com/python/cpython/blob/2.7/Lib/hashlib.py#L72). > This is the first time that I try to refactor code of CPython on GitHub, so > I am very excited. > > This is __get_builtin_constructor code on hasklib.py ,as follows. > > def __get_builtin_constructor(name): > try: > if name in ('SHA1', 'sha1'): > import _sha > return _sha.new > elif name in ('MD5', 'md5'): > import _md5 > return _md5.new > elif name in ('SHA256', 'sha256', 'SHA224', 'sha224'): > import _sha256 > bs = name[3:] > if bs == '256': > return _sha256.sha256 > elif bs == '224': > return _sha256.sha224 > elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'): > import _sha512 > bs = name[3:] > if bs == '512': > return _sha512.sha512 > elif bs == '384': > return _sha512.sha384 > except ImportError: > pass # no extension module, this hash is unsupported. > > raise ValueError('unsupported hash type ' + name) > > > When I read this code, it looks messy, so I want to refactor it and make it > become more clearly . > > Then, it will be like this > > def get_builtin_constructor(name): > try: > if name[:3] in ('SHA','sha'): >if(name[3:]=='1'): >import _sha >return _sha.new > >elif (name[3:] == '224'): >import _sha256 >return _sha256.sha224 > >elif (name[3:] == '256'): >import _sha256 >return _sha256.sha256 > >elif (name[3:] == '384'): >import _sha512 >return _sha512.sha384 > >elif (name[3:] == '512'): >import _sha512 >return _sha512.sha512 IMHO, this decreases the readability of the code. Also, we're doing string slicing at every conditional statement which doesn't make much sense. What do you find not interesting with the current code? What is the motivation behind this change? Best, Sanyam -- Mozilla Rep http://www.SanyamKhurana.com Github: CuriousLearner ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com