modernize icon indicating copy to clipboard operation
modernize copied to clipboard

instead of xxx_todo_changeme, use a name based on the original variables

Open daira opened this issue 11 years ago • 2 comments

E.g. instead of

-        def _got_root((root, path)):
+        def _got_root(xxx_todo_changeme):
+            (root, path) = xxx_todo_changeme

use

-        def _got_root((root, path)):
+        def _got_root(root_and_path):
+            (root, path) = root_and_path

Also, the X_and_Y convention could be used in cases like this:

-        d.addCallback(lambda (root, path):
-                      self._get_or_create_directories(root, path, metadata))
+        d.addCallback(lambda root_path:
+                      self._get_or_create_directories(root_path[0], root_path[1], metadata))

Here the generated name root_path is inappropriate because that would mean something like "path of the root", as opposed to a (root, path) pair. root_and_path would be better.

(moved from https://github.com/mitsuhiko/python-modernize/issues/15 )

daira avatar Aug 13 '14 00:08 daira

I believe the variable name xxx_todo_changeme comes from 2to3, not libmodernize, so we can't easily fix it.

takluyver avatar Aug 13 '14 00:08 takluyver

The second problem (root_path vs root_and_path) is just in the implementation of the tuple_name function of https://hg.python.org/cpython/file/4d4a9094bdb0/Lib/lib2to3/fixes/fix_tuple_params.py . The first is because at line 68, self.new_name is called without an argument (compare with line 124).

I think there is enough motivation to fork this code in order to fix this issue and #15.

daira avatar Jan 10 '15 10:01 daira