TeX $\times$ symbol not working in matplotlib?

gwhite gwhite at ti.com
Sat Apr 19 10:26:01 EDT 2014


On Friday, April 18, 2014 8:46:13 PM UTC-7, Larry Hudson wrote:
> On 04/18/2014 04:14 PM, gwhite wrote:
> 
> > [snip]
> > I'm not sure when a backslash continuation might be needed, or if that requirement has been designed out of Python.
> 
> ['they' meaning trailing backslashes]
> 
> No, 'they' are still definitely in Python, but can usually be avoided.
> 
> As already mentioned, strings are automatically concatenated if they are separated by only 
> whitespace (spaces/tabs/newlines).  But there is a difference between this concatenation and 
> using a trailing backslash.  For example:
> 
> print('this, that, '
>          'the other')
>  
> gives -> 'this, that, the other'
> 
> print('this, that, \
>          the other')
> 
> gives -> 'this, that,         the other'
> 
> The leading whitespace in the second example is significant, but is ignored in the first.
> 
> The other places you can avoid the trailing backslash is within brackets, ie. (), [] or {}.
> Here you can split at any 'natural' position, that is following a comma, dot or an operator.
> 
> ['spam',
>      'eggs',
> 'bacon']
>  
> gives -> ['spam', 'eggs', 'bacon']
> 
> --------- 
> [2 +
>       3, 
>            'spam']
>
> gives -> [5, 'spam']
> 
> ---------
> print('this' and
>      'that' or
>      'other')
> 
> gives -> 'that'
> 
> ---------
> print('{}'.
>      format('spam'))
> 
> gives -> 'spam'
> 
> These examples are somewhat contrived, but they do show what I'm talking about.
> 
> Of course, you can still use the trailing backslash method, but when you can avoid it it usually 
> looks cleaner.  Besides simply using either method to split long lines, it is often used to line 
> things up, either for the appearance or for documentation.  Here is a dictionary example of what 
> I mean (and the backslash method will NOT work here):
> 
> d = {1 : 'one',        #  Describe this key/value pair
>      2 : 'two',        #  Describe this one
>      3 : 'three'       #  Etc.
>     }
> 
> Play around in the interactive mode to check out how this splitting works.

Thank you, Larry.  Your concise examples are nicely illustrative of the essentials.  I appreciate the explanation.

Thanks again to everyone.  

If I had the time, I would become a Python addict.



More information about the Python-list mailing list