On Mon, 8 Jun 2015 09:21 pm, Albert van der Horst wrote:
> Why is "slug.title" a valid decomposition of the total string> > (Or is it?) I'm afraid I don't understand the question. > What is the ()-brackets doing? Does it force the execution of title, > which gives something to be dotted onto slug etc. See below. slug.title looks up an attribute called "title" attached to the object called "slug". In this case, slug is a string, so slug.title finds the string title method: py> slug = "hello" py> slug.title <built-in method title of str object at 0xb7b036e0> Then the round brackets (parentheses) calls that method with no arguments, which returns a new string: py> slug.title() 'Hello' > I interpreted the question as about the associative of the > dot operator. Technically, dot is not an operator. I believe that the docs call it a delimiter, but in once sense it is more than that because it also performs an attribute lookup. In any case, the order of applying dots is *strictly* left-to-right. -- Steven -- https://mail.python.org/mailman/listinfo/python-list