0
Can any explain about objects like integers created on the fly?
Creating a function normally (using def) assigns it to a variable automatically. This is different from the creation of other objects - such as strings and integers - which can be created on the fly, without assigning them to a variable.
2 Antworten
+ 8
I don't know if it's what you mean, but method definition automatically assigns a name to it (unless it is a lambda, which is an anonymous function). You can then call it, with parameters or without, whether it returns some value or not.
On the other hand, objects like integers or strings may not necessarily be glued to a variable.
print("Hello world") will just print out the greeting. The print() method will be called, the "Hello world" string will be passed as argument/parameter, but it will not be assigned to any variable.
That what you meant?
0
Yes now i am cleared.. thanks kuba