4 ms·
Yes the python APIs are very inconsistent, but I disagree about the del statement. That's a different matter and the way Zed looks at it is very much the kind o
by fauigerzigerk 17y ago
Yes the python APIs are very inconsistent, but I disagree about the del statement. That's a different matter and the way Zed looks at it is very much the kind of hemispatial neglect that tends to befall people who are immersed too deeply in the OO paradigm.
del x unbinds x from whatever namespace it resolves to. How would you say c.remove(x) if you don't know which collection c represents? Now, of course you could argue that del x is too different from removing something from a collection to have it use the same syntax. But that's not about neglect. It's just a different opinion about what is consistent.
The reasoning is probably that removing a variable should always be done in one way and that is del x no matter if x is inside a collection we know or not. It's a very conscious attempt to make it consistent and that's not neglect. Whether it's a good idea I don't know.
Maybe a global del function would be better. If x is inside c and we know what c is we would say c.del(x) and if we want c to be resolved we say del(x). But is that really so different from what we have now?
More generally, my opinion is that the way functions are used in OO is in itself very inconsistent. If you have a function f and variables x, y, and z, it's mostly a consideration of implementation details that leads to a decision of whether it should be x.f(y, z), y.f(x, z) or z.f(x, y). Why does the user of an API have to think about or remember which one it is?
- deleted 17y ago[deleted]