Lists And Missing Commas

Aaron Gray aaronngray.lists at gmail.com
Mon Dec 23 20:01:22 EST 2019


On Tuesday, 24 December 2019, Tim Daneliuk <info at tundraware.com> wrote:

> If I do this:
>
>     foo = [ "bar", "baz" "slop", "crud" ]
>
> Python silently accepts that and makes the middle term "bazslop".


Strings concatinate over line endings so this case is only sensible really.


>
> BUT, if I do this:
>
>     foo = [ "bar", "baz" 1, "crud" ]
>
> or this:
>
>     foo = [ "bar", 2 1, "crud" ]
>
> The interpreter throws a syntax error.
>
> This is more of an intellectual curiosity than anything else, but why do
> strings silently
> concatenate like that, while all other case blow up with an error.  i.e.,
> What is about
> the language the promotes this behavior.  At first blush, it seems
> inconsistent, but what
> do I know ...
>
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Independent Software Engineer and amateur Computer Scientist


More information about the Python-list mailing list