Can I use a builtin name as a method name of a Python class?
<p>I have a class that performs some simple data manipulation, I need three methods: set, add, sub:</p>

<pre><code>class Entry():  # over-simplified but should be enough for the question
    def __init__(self, value):
        self.set(value)
    def set(self, value):
        self.value=value
    def add(self, value):
        self.value += value
    def sub(self, value):
        self.value -= value
</code></pre>

<p>The problem is with the "set" method but defining it as a class method should not clash with the "set()" builtin function.</p>

<p>The <a href="https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments" rel="nofollow" title="Python Style Guide">Python Style Guide</a> states that argument names of functions and methods should not shadow built-in functions, but it's this the case for method names?</p>

<p>Obviously I could choose another method name, but the question is more generic and valid for other possible method names (i.e. filter, sum, input).</p>

<p>You are fine.  You just don't want to overwrite the built-ins if they are a built-in method <em>__init__</em> <em>__iter__</em> etc unless you are implementing the functionality expected by those methods.</p>

<p>You are "overwriting" a built in <em>function</em> as a class method, which means you aren't really overwriting anything.  This is acceptable.</p>

python pep8