Allowing comments after the line continuation backslash
Martin v. Loewis
martin at v.loewis.de
Mon Nov 1 03:44:54 EDT 2010
> Sorry if I am baking too many ideas today.
> I am just having trouble with the backslashes....
>
> I would like to have comments after the line continuation backslash.
>
>>>> if a > 0 \ #comments for this condition
> and b > 0:
> #do something here
>
> This is currently not OK, but this might be a good thing to have.
Can you say why it would be a good idea?
FWIW, I would write your fragment as
if (a > 0 #comments for this condition
and b > 0):
#do something here
i.e. avoid the backslash for multi-line conditions altogether
(in fact, I can't think any situation where I would use the backslash).
Regards,
Martin
More information about the Python-list
mailing list