The latest version of the PEP clarifies that both are allowed. On 2/23/07, Jim Jewett <jimjjewett at gmail.com> wrote: > On 2/22/07, Guido van Rossum <guido at python.org> wrote: > > [-python-checkins, +python-dev] > > > > On 2/22/07, Jim Jewett <jimjjewett at gmail.com> wrote: > > > > __setitem__ > > > > __setslice__ > > > > append > > > > count > > > > + decode > > > > + endswith > > > > extend > > > > + find > > > > index > > > > insert > > > > + join > > > > + partition > > > > remove > > > > + replace > > > > + rindex > > > > + rpartition > > > > + split > > > > + startswith > > > > + rfind > > > > + rindex > > > > + rsplit > > > > + translate > > > > What sort of arguments do they take? > > > You should be able to infer this from what the corresponding str or > > list methods do -- always substituting bytes for those, and int for > > the single element. > ... > > > Single integers? startswith(ord('A')) > > > > TypeError (this is the same as the previous.) > > >>> "asdf".index("df") == "asdf".index("d") > > Assuming : > >>> data = bytes("asdf", 'ASCII') > > Are you saying that, even for the single-char call, I must write: > >>> data.index(bytes("d", 'ASCII')) > > instead of: > >>> data.index("d") > > or even: > >>> data.index(ord("d")) > > -jJ > -- --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4