By:
"reference cycles: if one object has a reference to another, and
that second object also has a reference to the first, that's a cycle."
Is this what you mean?
a = 5
b = a
a = b
I just want to make sure I understand.
Thank you very much for your explanation.
Monika
-- Original Mes
Hi Pythonistas
What's the correct way to define/access methods of a member variable in a
class pointing to an object?
For example, I have a class Foo that has a method foo_method:
class Foo:
def foo_method(self):
return 'bar'
Now, in another class Bar, I'd like to store an object to
On Sat, Sep 03, 2016 at 11:25:07AM +0530, Sharad Singla wrote:
> Hi Pythonistas
>
> What's the correct way to define/access methods of a member variable in a
> class pointing to an object?
Python recommends that you start with the simplest thing that will work
first, which is direct attribute ac
monik...@netzero.net wrote:
>
> By:
> "reference cycles: if one object has a reference to another, and
> that second object also has a reference to the first, that's a cycle."
>
> Is this what you mean?
> a = 5
> b = a
> a = b
No. int instances are immutable. The assignments above bind both /na
Hi,
Composition is a technique that allows you to express the 'has a'
relationship between your object.
I'm not a specialist of the OOP but I can see some issues in the model that
you expose in your mail.
Encapsulation and abstraction are all about designing an API. It allows you
to expose simpl
On Fri, Sep 2, 2016, at 23:25, monik...@netzero.net wrote:
>
> By:
> "reference cycles: if one object has a reference to another, and
> that second object also has a reference to the first, that's a cycle."
>
> Is this what you mean?
> a = 5
> b = a
> a = b
>
> I just want to make sure I under
On 03/09/16 06:55, Sharad Singla wrote:
> What's the correct way to define/access methods of a member variable in a
> class pointing to an object?
Steven has already given you a long and comprehensive
answer based on pragmatic python programming. But since
you use the term "correct" I'll give you
On 03/09/16 04:25, monik...@netzero.net wrote:
> Is this what you mean?
> a = 5
> b = a
> a = b
No, you are confusing variable names with objects.
Here you only have one object - the number 5.
For a cycle you need at least 2 objects and those
objects must be able to reference another object.
In
On Thu, Sep 01, 2016 at 08:21:36PM +, monik...@netzero.net wrote:
> Thank you for your explanation. It is very clear and confirms what I
> thought I knew. However, I had a job interview and the interview said
> it was a mistake that I did not say that in cases when there are
> multiple prog
On Thu, Sep 01, 2016 at 05:35:33AM +, monik...@netzero.net wrote:
> Hi:
> I have been taking python classes for overa year now and studying and
> studying it all days long. However, I still cannot get a job as a
> python automation qa (despite of many years of experience in qa)
> because eve
On Sat, Sep 03, 2016 at 02:51:22PM +0100, Alan Gauld via Tutor wrote:
[...]
> The first thing to do is point out that what you
> are asking about is the Law of Demeter on OOP.
> See Wikipedia for a full description. In essence
> it says that the user of an object should not
> directly access that
On 03/09/16 18:17, Steven D'Aprano wrote:
> One classic example of the Law Of Demeter is:
>
> "If you want your dog to come to you, don't talk to your dog's legs,
> talk to the dog."
I love that, I've never seen it before but a great example.
> But sometimes the Law Of Demeter should not apply
Hello,Am trying to solve a problem, but keep getting different errors.
Country X calculates tax for its citizens using a graduated scale rate as shown
below:
- Yearly Income: 0 - 1000Tax Rate: 0%
- Yearly Income: 1,001 - 10,000Tax Rate: 10%
- Yearly Income: 10,001 - 20,200Tax Rate: 15%
So what does [...] mean?
-- Original Message --
From: Peter Otten <__pete...@web.de>
To: tutor@python.org
Subject: Re: [Tutor] python memory management
Date: Sat, 03 Sep 2016 14:26:12 +0200
monik...@netzero.net wrote:
>
> By:
> "reference cycles: if one object has a reference to
@Steven, @Khalil, @Alan
Thanks for the inputs/explanations.
Appreciate it!
Regards
Sharad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Is there any practical usage of using reference cycling?
On Sat, 2016-09-03 at 14:56 +0100, Alan Gauld via Tutor wrote:
> On 03/09/16 04:25, monik...@netzero.net wrote:
>
> >
> > Is this what you mean?
> > a = 5
> > b = a
> > a = b
>
> No, you are confusing variable names with objects.
> Here
On 03/09/16 22:16, monik...@netzero.net wrote:
> So what does [...] mean?
Its Python's way of telling you that you have a
self referential data structure. Its just a
representational thing but without it Python
would end up printing an infinite sequence
of values.
HTH
--
Alan G
Author of the Le
On 03/09/16 23:20, zakaria wrote:
> Is there any practical usage of using reference cycling?
There are a (very) few cases where data structures require the
creation of cyclic references. One example I've used is in
managing comms networks where nodes are multiply and/or
cyclically linked and you n
Hi Chidinma,
I'm afraid it is very difficult for me to understand your code, because
your email program (Yahoo mail perhaps?) has mangled the code and put it
all on one single line:
On Sat, Sep 03, 2016 at 09:45:17PM +, Chidinma via Tutor wrote:
> def calculate_tax(dict_inp): result = {}
19 matches
Mail list logo