From 35b0ba6a57b16efbd7d384938b453de6f42e0d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 13 Aug 2018 16:11:36 +0200 Subject: [PATCH] Enum --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 98823c7..5e9addc 100644 --- a/README.md +++ b/README.md @@ -451,15 +451,19 @@ class : # Use f'{s.__dict__}' for all members. def __str__(self): return str(self.a) + + @classmethod + def get_class_name(cls): + return cls.__name__ ``` ### Enum ```python -import enum -class (enum.Enum): - = - = - = enum.auto() # Can be used for automatic indexing. +from enum import Enum, auto +class (Enum): + = + = , + = auto() # Can be used for automatic indexing. ... ``` @@ -936,7 +940,7 @@ duration = time() - start_time #### Times execution of the passed code: ```python from timeit import timeit -timeit('"-".join(str(n) for n in range(100))', number=1000000) +timeit('"-".join(str(n) for n in range(100))', number=1000000, , globals=globals()) ``` #### Generates a PNG image of call graph and highlights the bottlenecks: