Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4907
| Date | 2011-05-07 15:31 +0300 |
|---|---|
| From | Claudiu Popa <cpopa@bitdefender.com> |
| Subject | Custom string joining |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1289.1304771900.9059.python-list@python.org> (permalink) |
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 | Next — Next in thread | Find similar | Unroll 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