Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100175

Re: Accessing container's methods

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Erik <python@lucidity.plus.com>
Newsgroups comp.lang.python
Subject Re: Accessing container's methods
Date Tue, 8 Dec 2015 22:37:46 +0000
Lines 41
Message-ID <mailman.78.1449614324.12405.python-list@python.org> (permalink)
References <dcm0c2Fi2ktU1@mid.individual.net> <mailman.41.1449532084.12405.python-list@python.org> <5516674.oipO6xLiNU@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de NCmMFQtiR9zzLyZGU8i/1wcZ0bCLGfYebCqHOw9Cr9vw==
Return-Path <python@lucidity.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'context': 0.05; '(of': 0.07; 'seemed': 0.07; 'though:': 0.07; 'python': 0.10; 'question.': 0.13; '(which,': 0.16; 'after,': 0.16; 'containers': 0.16; 'curious.': 0.16; 'description)': 0.16; 'erik': 0.16; 'fix,': 0.16; 'from:addr:python': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'snippets': 0.16; 'subject:Accessing': 0.16; 'wrote:': 0.16; 'string': 0.17; 'element': 0.18; 'expanded': 0.18; 'library': 0.20; 'posted': 0.21; 'to:2**1': 0.21; 'arguments': 0.22; 'bit': 0.23; 'wrote': 0.23; 'errors': 0.23; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'sense': 0.26; 'question': 0.27; 'said,': 0.27; "skip:' 10": 0.28; 'container': 0.29; 'context,': 0.29; 'now?': 0.29; 'objects': 0.29; "i'm": 0.30; 'comments': 0.30; 'code': 0.30; 'supposed': 0.31; 'received:84': 0.32; 'class': 0.33; 'option.': 0.33; 'scalable': 0.33; 'list': 0.34; 'question,': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'why': 0.39; 'sure': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; "you'll": 0.61; 'thomas': 0.63; 'more': 0.63; 'soon': 0.65; 'realise': 0.66; 'shortly': 0.72; 'special': 0.73; 'attention': 0.76; 'saw': 0.77; 'responses': 0.93
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=JN/GyJ+b c=1 sm=1 tr=0 a=Ypmeq7T0cKALDUsRPCToMg==:117 a=Ypmeq7T0cKALDUsRPCToMg==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=IkcTkHD0fZMA:10 a=cAocOpxOISkVwG8NprUA:9 a=QEXdDO2ut3YA:10
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
In-Reply-To <5516674.oipO6xLiNU@PointedEars.de>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100175

Show key headers only | View raw


Annoyingly, there seemed to be no responses to the original question 
when I wrote that and then shortly after, I saw all the others (and we 
all pretty much said the same thing - so I'm not sure why I was singled 
out for special attention ;)).

On 08/12/15 19:02, Thomas 'PointedEars' Lahn wrote:
> Erik wrote:
> ^^^^
> Please fix, Erik #75656.

Fixed(*)

Thomas 'PointerEars', you have chosen to selectively quote snippets of 
code and comments out of context, so I think it's futile to respond to 
those arguments individually. The original request (if you read it) was 
to return a string that said, essentially, "I am element 2 of 3 in my 
container".

You posted a "Quickhack" (which, to be fair, is an accurate description) 
which is incomplete, has errors and makes no sense in the context of the 
original question. We all know we can create a list in Python (of parent 
objects or whatever), but I think that if you expanded on that class a 
bit more (methods for the containers to update the contained objects on 
just what their index/key is etc) that you'll soon realise it's not a 
scalable option.

Also, WRT the original question, what is the method supposed to return 
now? "I am element 0 of 3 in container <FOO>, key 'bar' of ('bar', 
'foo', 'spam') in container <BAR>"? Just curious.

I'm interested in this response though:

 >> Generally, an object should not need to know which container it's in
 >
 > NAK.  All kinds of objects already "know" which container they are in.

Please elucidate. Examples from the standard library would be interesting.

E.

(*) In the sense that it's not going to change ;)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing container's methods Tony van der Hoff <tony@vanderhoff.org> - 2015-12-07 18:10 +0000
  Re: Accessing container's methods Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2015-12-07 18:21 +0000
  Re: Accessing container's methods Michael Torrie <torriem@gmail.com> - 2015-12-07 11:36 -0700
    Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 20:03 +0100
  Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 19:46 +0100
  Re: Accessing container's methods Peter Otten <__peter__@web.de> - 2015-12-07 19:59 +0100
  Re: Accessing container's methods Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-07 12:33 -0700
  Re: Accessing container's methods Terry Reedy <tjreedy@udel.edu> - 2015-12-07 16:38 -0500
  Re: Accessing container's methods Chris Angelico <rosuav@gmail.com> - 2015-12-08 09:02 +1100
  Re: Accessing container's methods Erik <python@lucidity.plus.com> - 2015-12-07 23:47 +0000
    Re: Accessing container's methods Tony van der Hoff <tony@vanderhoff.org> - 2015-12-08 12:35 +0000
    Re: Accessing container's methods [solved] Tony van der Hoff <tony@vanderhoff.org> - 2015-12-08 13:46 +0000
    Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 20:02 +0100
      Re: Accessing container's methods Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2015-12-08 20:54 +0100
        Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 23:51 +0100
      Re: Accessing container's methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-08 20:30 +0000
        Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 23:52 +0100
          Re: Accessing container's methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-08 22:59 +0000
      Re: Accessing container's methods Erik <python@lucidity.plus.com> - 2015-12-08 22:37 +0000
      Re: Accessing container's methods Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-08 16:41 -0700
      Re: Accessing container's methods Chris Angelico <rosuav@gmail.com> - 2015-12-09 12:04 +1100

csiph-web