Bug or intended behavior?

Chris Angelico rosuav at gmail.com
Sat Jun 3 18:05:54 EDT 2017


On Sun, Jun 4, 2017 at 7:59 AM, Sean DiZazzo <sean.dizazzo at gmail.com> wrote:
> I get what it's doing, it just doesn't make much sense to me.  Looking at operator precedence, I only see the % operator in regards to modulus.  Nothing in regards to string formatting.  Is it just a side effect of the % being overloaded in strings?   Or is it intentional that it's higher precedence...and why?
>
> Maybe I'm making too big a deal of it.  It just doesn't 'feel' right to me.

The operator is what it is regardless of the values on either side of
it. The somewhat cute use of a division operator for either percent
formatting or path joining doesn't change this.

ChrisA



More information about the Python-list mailing list