How do I chain methods?
James Mills
prologic at shortcircuit.net.au
Sun Oct 24 19:39:47 EDT 2010
On Mon, Oct 25, 2010 at 9:21 AM, chad <cdalten at gmail.com> wrote:
> I just saw this technique used in python script that was/is used to
> automatically log them in myspace.com. Hence the question.
Function/Method Chaining is probably used a lot in Python itself:
>>> x = 4
>>> x.__add__(1).__sub__(3)
2
The implementation of many common operators return self (the object
you're working with).
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
More information about the Python-list
mailing list