decorator tag

3 questions


1 answers
320 views
0
I don't know what it is, but I'm curious about this. To add additional variables to an already defined function.

from shapely.geometry import Pointdef somefunc(lst): return [Point(x) for x in lst]if __name__ == __main__: xy = [(x, x) for x in range(1, 10)] print(somefunc(xy)) There is a need to add a count varia...

1 years ago

1 answers
109 views
0
What is the difference between writing and not writing self in the class method?

When I made the code in Faicham, they automatically put self on itWhy are you doing this?I wonder what role self plays, so if you take out self, there will be an error.class Test(object): def method_o...


1 answers
68 views
0
To wrap a function imported from another file with @Decorator

file 1def file1_fun():file2from file1 import file1_fundef deco(target): DecoratedYes) def wrapper(): Sentences to execute first result = target() Sentences to run later return wrapper @decofile1_fu...

1 years ago

© 2024 OneMinuteCode. All rights reserved.