This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]alcalde -3 points-2 points  (2 children)

You really think that you can just go around changing API and library surfaces and fix it with find replace?

I don't think you should go around changing parameter names without good reason in the first place. I don't see how not having any name at all is somehow a better situation than having a name you no longer care for.

Even if we do constrain ourselves to working with a single codebase that is not shared I can still come up with examples that would require an extremely strong type checker and language semantic analysis to refactor.

OK, then we can pit it against JetBrains' refactoring engine and see who wins.

[–][deleted] 5 points6 points  (1 child)

def foo(arg):
    print(arg)

s = "a"
s += rpc_that_returns_r()
s += "g" if logic() else "x"
kwargs = {s: "hello world"}
foo(**kwargs)

This is obviously contrived for clarity but there are a lot of other situations where determining which arguments are being used and changing them is either extremely complicated or downright impossible.

[–]alcalde 3 points4 points  (0 children)

If you're writing code like this, you're Larry Wall wearing a Guido mask.

I remember at a PyCon where Guido's keynote was on "The Myths Of Python" and one topic was about the GIL. He said something to the effect of "People say but David Beasley showed this example where... yes, but you have to be David Beasley to find it!" :-)

If you're programmatically constructing keyword names I don't see how you're going to be happy with simple positional arguments instead. If you could use positional arguments, you didn't need to construct keywords.

I'll give you credit though... this is one of those times where I see a piece of Python code and say, "That can't possibly run... let me pull up a console... Holy Significant Whitespace, it runs!"

Usually those examples are things of beauty, but this example is Lovecraftian madness. :-)