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/2004-November/050102.html below:

[Python-Dev] String literal concatenation & docstrings

[Python-Dev] String literal concatenation & docstringsNick Coghlan ncoghlan at iinet.net.au
Fri Nov 26 15:21:27 CET 2004
A c.l.p question about docstring formatting got me curious about something.

http://www.python.org/doc/2.3.4/ref/string-catenation.html states that:
   Multiple adjacent string literals (delimited by whitespace), possibly using
   different quoting conventions, are allowed, and their meaning is the same as
   their concatenation. Thus, "hello" 'world' is equivalent to "helloworld".

This isn't quite true, since the following doesn't work:

   def some_func():
     """Doc string line 1 (the only line, surprisingly)\n"""
     """Doc string line 2, except it isn't."""

It seems like an odd quirk that the compile-time concatenation of string 
literals doesn't work for docstrings. I had a bit of trawl through the docs and 
the archive with Google, but couldn't find anything that stated whether this 
behaviour was deliberate or accidental.

So, can anyone satisfy my idle curiousity as to whether this was a deliberate 
design choice, or an accident of the implementation?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net
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