tuple to string?

John Machin sjmachin at lexicon.net
Sun Jul 24 07:55:19 EDT 2005


Steven D'Aprano wrote:
> On Sat, 23 Jul 2005 23:31:04 +1000, John Machin wrote:
> 
> 
>>>>You don't need the sissy parentheses; '%c' * len(t) % t works just fine :-)
>>>
>>>
>>>Ah, ok. Didn't want to lookup the precedence rules...
>>
>>
>>Look up the precedence rules? Are you aware of any language where * / 
>>and % _don't_ have the same precedence??
> 
> 
> Do languages like Pascal that don't have string formatting expressions, or
> use the % operator, count?

A thousand pardons; I should have said "Are you aware of any language 
which has % (as primarily a numeric remainder/modulo operator) but * /
and % _don't_ have the same precedence??"

OK, given a language which does have * and / used among other things for 
numerical multiply and divide, (a) are you aware of any such language 
which does does not have * and / at the same precedence level (b) 
supposing one wanted to introduce % as a numerical 
remainder/modulo/whatever operator (plus other meaning(s) for 
non-numeric types), would you care to argue that it should not have the 
same precedence level (as * and /)?

Pascal was/is a prime example of bad precedence choice:
a > b or c > d
means
a > (b or c) > d
in Pascal (not very useful)
and
(a > b) or (c > d)
in many other languages.


> 
> How about languages like Forth that don't have precedence rules at all,
> unless "first come, first served" is a precedence rule?

No precedence rules -> no relevance to the topic



More information about the Python-list mailing list