A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-December/018848.html below:

[Python-Dev] nested scopes confusion

[Python-Dev] nested scopes confusion [Python-Dev] nested scopes confusionThomas Heller thomas.heller@ion-tof.com
Tue, 4 Dec 2001 21:28:17 +0100
> But the performance characteristics of class vs. function is really
> the bottleneck of your application?  Are you sure that nested fuctions
> are really cheaper?
Is seems do.

Here's a simple test:

def Method(index):
    return lambda self, *args: index

class A:
    def test(self, *args):
        return 5

class C:
    test = Method(42)

a = A()
c = C()

Calling a.test() takes 3.3 microseconds, and c.test() takes 3.16 microseconds.

Thomas




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4