A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/1999-June/095456.html below:

[Python-Dev] Re: [Python-Dev] Re: [Python-Dev] String methods... finally

[Python-Dev] Re: [Python-Dev] Re: [Python-Dev] String methods... finally [Python-Dev] Re: [Python-Dev] Re: [Python-Dev] String methods... finallyFredrik Lundh fredrik at pythonware.com
Tue Jun 15 16:28:17 CEST 1999
> > hmm.  consider the following:
> > 
> >     space = " "
> >     foo = L"foo"
> >     bar = L"bar"
> >     result = space.join((foo, bar))
> > 
> > what should happen if you run this:
> > 
> >     a) Python raises an exception
> >     b) result is an ordinary string object
> >     c) result is a unicode string object
> 
> The same should happen as for L"foo" + " " + L"bar".

which is?

(alright; for the moment, it's (a) for both:

>>> import unicode
>>> u = unicode.unicode

>>> u("foo") + u(" ") + u("bar")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation

>>> u("foo") + " " + u("bar")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation

>>> u(" ").join(("foo", "bar"))
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: first argument must be sequence of unicode strings

but that can of course be changed...)

</F>



More information about the Python-Dev mailing list

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