Ooo thanks I understood.
On Thu, 19 Mar, 2020, 8:10 pm Pieter van Oostrum,
wrote:
> Souvik Dutta writes:
>
> > I should have been more clear
> > class first():
> > print("from first")
> > def second():
> > print("from second")
> > first()
> >
> > When I run the above code the
Souvik Dutta writes:
> I should have been more clear
> class first():
> print("from first")
> def second():
> print("from second")
> first()
>
> When I run the above code the output is
> "from first"
And where do you think this comes from? Are you thinking this comes from
the
On 19/03/2020 13:58, Souvik Dutta wrote:
I should have been more clear
class first():
print("from first")
def second():
print("from second")
first()
When I run the above code the output is
"from first"
(2ND CODE)
class first():
print("from first")
def second():
On Fri, Mar 20, 2020 at 1:04 AM Souvik Dutta wrote:
>
> I should have been more clear
> class first():
> print("from first")
> def second():
> print("from second")
> first()
>
> When I run the above code the output is
> "from first"
> (2ND CODE)
>
Try this *without* the call to
I should have been more clear
class first():
print("from first")
def second():
print("from second")
first()
When I run the above code the output is
"from first"
(2ND CODE)
class first():
print("from first")
def second():
print("from second")
first.second()
When I
Chris Angelico writes:
> Creating the class runs all the code in the class block, including
> function definitions, assignments, and in this case, a print call.
>
> Classes are not declarations. They are executable code.
Demo:
In [26]: class first():
... print("From first")
...
On Thu, Mar 19, 2020 at 12:30 PM Souvik Dutta wrote:
>
> Hi,
> I wrote a purposeless code today.
>
> class first():
> print("From first")
> def second():
> print("From second")
> first()
> first.second()
>
>
> Now the output I get is
> From first
> From second
>
> But when I
Hi,
I wrote a purposeless code today.
class first():
print("From first")
def second():
print("From second")
first()
first.second()
Now the output I get is
>From first
>From second
But when I comment the call of first that is the comment the second last
line of the code