View Single Post
Old 09-30-2020, 08:59 AM   #156
Minsam
Junior Member
Minsam began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2020
Device: none
Quote:
Originally Posted by JimmXinu View Post
New Test Version Attached

Changelog:
Version 1.2.11 - 29 Sep 2020
Better more compatibility with Python 3

Two important things about this:
  1. A book in the library that has never had a series set comes up a little differently than one that had a series at one time, but doesn't anymore. That's why I didn't see it at first.
  2. In Python2, you could compare any two values or variables and value None (of type NoneType) was considered 'less' than anything you compared it with. Python3 incompatibly changed that to 'you can't compare None to anything.
So I, thinking I was clever, changed where this plugin returned None as a default series index to float(-inf), so that it would still be 'less than anything else'.

That's when another pythonic habit bit me--None is always considered False when used in a boolean (as is 0 and empty string('')), so it's common to just do "if var:"

But "if float(-inf):" evaluates to True. Thereby changing the behavior.

So this version returned 0 where it used to be None instead of float(-inf).
Working now. Thanks.
Minsam is offline   Reply With Quote