Comments (7)
Original comment by Bernhard Gschaider (Bitbucket: bgschaid, GitHub: bgschaid):
That's fine with me. The thing was I saw the docu when porting and thought "Ah. Keyword arguments. That is self-documenting. Lets use it". And I didn't test that particular path on python3 so I didn't see the error of my ways
from six.
I hope that's good enough for you.
from six.
rename python 2's exec_ arguments to avoid accidently calling with keywords (fixes #16)
from six.
Original comment by Bernhard Gschaider (Bitbucket: bgschaid, GitHub: bgschaid):
Right. So exec_
behaves differently on Python2 and Python3 and the point of six is to hide these differences. So what I'd propose is either
-
Write for Python3 a function that wraps
exec
and accepts keywords -
Rewrite the Python2 implementation to something like (just a sketch)
#!python
def exec_(code,*args):
globs,locs=None,None
if len(args)>0:
globs=args[0]
if len(args)>1:
locs=args[1]
if len(args)>2:
raise TypeError("exec expected at most 3 arguments, got 4")
# After that the current implementation
from six.
You shouldn't rely on it, though because
#!pycon
Python 3.4.0a0 (default:ce99559efa46+, Jan 8 2013, 11:43:31)
[GCC 4.5.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
x>>> exec("x", globals={})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: exec() takes no keyword arguments
from six.
Original comment by Bernhard Gschaider (Bitbucket: bgschaid, GitHub: bgschaid):
Yes. I ported a piece of code that used them as named parameters and it blew up
from six.
I assume the difference you're referring to is the argument names?
from six.
Related Issues (20)
- Please make a new release with the py3.10 fixes
- bad magic number in 'six' HOT 4
- What version of collections_abc is supported? HOT 2
- Different versions of packages (geckodriver) can be installed on linux and windows
- can i use six just like run command on cmd like six filename.py? HOT 1
- ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
- RuntimeError: restricted attribute setting __doc__ when being imported in python2.7 in a restricted frame
- Module MD5 could be moved to hashlib.md5? HOT 1
- Python:3.11 failing to install six (pip version: 22.3.1)
- Version 1.16.0 vulnerable to OS Command Injection
- Failure when using six.with_metaclass in python 2.7 when metaclass doesn't directly inherit from type
- SIX new version HOT 4
- six.reraise fails
- repr(six.moves) throws an AttributeError for cpython 3.12 HOT 5
- Why name the tool six ? six = 2x3 ? HOT 2
- Undefined reference to unicode
- Getting Code Vulnerability in "six.py" module file HOT 11
- ModuleNotFoundError: No module named 'ansible.module_utils.six.moves' HOT 1
- ModuleNotFoundError: No module named 'six.moves' HOT 7
- Feature request: Add shlex_join
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from six.