Paul Hankin wrote:
> On Nov 12, 3:25 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I have recently been learning python, and coming from a java
>> background there are many new ways of doing things that I am only just
>> getting to grips with.
>>
>> I wondered if anyone could ta
> def __init__(self, connections = None, uid = None):
> """
> Args:
> [connections - a list of (connected node, weight) tuples. ]
> [uid - an identifier for comparisons.]
> """
> self._connected = []
> self._weights = []
>
> if connections:
>
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> def __init__(self, connections = None, uid = None):
You can use connections=(), so you don't need the "if" below. In
fact, you can further write:
for node, weight in connections:
self._connected.append(node)
self._weigh
On Nov 12, 3:25 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have recently been learning python, and coming from a java
> background there are many new ways of doing things that I am only just
> getting to grips with.
>
> I wondered if anyone could take a look at a few pieces of c
[EMAIL PROTECTED] napisaĆ(a):
> def getConnected(self):
> return self._connected
No need to use accessors. Just plain attribute lookup is sufficient.
--
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
"We read Knuth so you don't have to." (Tim Pet