Am 17.01.2012 19:02, schrieb Sandro Tosi: >> I should have given more info, as I wanted the opposite result :) >> file.next should not link to the next function but to the file.next >> method. Because Sphinx does not differentiate between >> meth/func/class/mod roles, :meth:`next` is not resolved to the nearest >> next method as one could expect but to the next function, so we have to >> use :meth:`~SomeClass.next` or :meth:`.next` (local ref markup) to get >> our links to methods. > > I tried :meth:`.next` but got a lots of : > > /home/morph/cpython/py27/Doc/library/stdtypes.rst:2372: WARNING: more > than one target found for cross-reference u'next': iterator.next, > multifile.MultiFile.next, csv.csvreader.next, dbhash.dbhash.next, > mailbox.oldmailbox.next, ttk.Treeview.next, nntplib.NNTP.next, > file.next, bsddb.bsddbobject.next, tarfile.TarFile.next, > generator.next > > so I ended up with :meth:`next` but it was still wrong. I've committed > 51e11b4937b7 which uses :meth:`~file.next` instead, and it works.
No need to try, just read the docs :) `next` looks in the current (class, then module) namespaces. `.next` looks everywhere, so the match must be unique. So for something as common as "next", an explicit `file.next` is required. Georg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com