On Mon, Jul 9, 2012 at 3:22 AM, Terry Reedy email@example.com wrote:
On 7/8/2012 9:14 AM, nick.coghlan wrote: If you want to report both errors, when present:
I don't really - when there are multiple things wrong with the address, ipaddress just reports the first one it notices (e.g. IPv4Address("google.com") will complain about the lack of "." separators rather than the fact that "google" and "com" are not valid octets).
This was just a case where I started to reorder the checks to do the faster one first, and then realised it was more user friendly to check the other way around (since the success case will always include both checks, it only makes a difference to the speed of rejection of some invalid cases). Most of the other validation checks have a more obvious suitable order (for example, there's no reason to start checking individual parts if we can't even split the parts up appropriately).
+class BaseTestCase(unittest.TestCase): # One big change in ipaddress over the original ipaddr module is # error reporting that tries to assume users *don't know the rules* # for what constitutes an RFC compliant IP address
Good assumption. There *will* be people who learn by trial and error.
*cough* It's conceivable I started down this path due to using the REPL for exploration while making an initial attempt at writing method and data attribute docs over the weekend. I'm firmly in the category of IPv4 network programming engineers with next to no IPv6 experience :)