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


Groups > comp.lang.python > #4907

Custom string joining

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <cpopa@bitdefender.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'defines': 0.07; 'advance.': 0.09; 'subject:string': 0.09; 'this:': 0.11; 'python- list,': 0.16; 'subject:joining': 0.16; 'seems': 0.21; 'objects': 0.24; 'object': 0.27; 'function': 0.27; 'work.': 0.27; "doesn't": 0.28; 'thanks': 0.29; 'skip:" 30': 0.29; 'list': 0.30; 'charset:iso-8859-15': 0.31; 'to:addr:python-list': 0.32; 'implemented': 0.33; 'sufficient': 0.33; 'some': 0.37; 'case': 0.37; 'but': 0.38; 'though': 0.38; 'work?': 0.39; 'to:addr:python.org': 0.39; 'received:(helo localhost)': 0.73; 'subject:Custom': 0.84; 'received:ro': 0.91
Date Sat, 7 May 2011 15:31:33 +0300
From Claudiu Popa <cpopa@bitdefender.com>
X-Priority 3 (Normal)
To python-list@python.org
Subject Custom string joining
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-15
Content-Transfer-Encoding quoted-printable
X-BitDefender-Spam No (0)
X-BitDefender-SpamStamp v1, build 2.8.97.148860, SQMD Hits: InvalidIPBytes34 97.192.25.0, rbl score: 0(0), bayes score: 500(0), pbayes score: 500(0), neunet score: 0(0), flags: [NN_LEGIT_BITDEFENDER; NN_LEGIT_MAILING_LIST_TO], SQMD: a969abe9241dbd49ba2c1b813a8e6689.fuzzy.fzrbl.org, total: 0(775)
X-BitDefender-Scanner Clean, Agent: BitDefender qmail 3.1.0 on elfie.dsd.hq, sigver: 7.37387
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1289.1304771900.9059.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 82.94.164.166
X-Trace 1304771900 news.xs4all.nl 81474 [::ffff:82.94.164.166]:41072
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4907

Show key headers only | View raw


Hello Python-list,

I  have  an object which defines some methods. I want to join a list or
an iterable of those objects like this:

new_string = "|".join(iterable_of_custom_objects)

What   is   the   __magic__  function that needs to be implemented for
this case to work?  I  though  that  __str__  is sufficient but it doesn't seems to
work. Thanks in advance.

PC

  


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


Thread

Custom string joining Claudiu Popa <cpopa@bitdefender.com> - 2011-05-07 15:31 +0300
  Re: Custom string joining Martineau <ggrp2.20.martineau@dfgh.net> - 2011-05-09 12:26 -0700
    Re: Custom string joining Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-09 14:07 -0600

csiph-web