[Checkins] SVN: zope.schema/trunk/src/zope/schema/_field.py pep8; whitespaces

Zvezdan Petkovic zvezdan at zope.com
Mon Nov 30 11:31:18 EST 2009


On Nov 30, 2009, at 6:15 AM, Godefroid Chapelle wrote:

> Log message for revision 106108:
>  pep8; whitespaces
> 
> Changed:
>  U   zope.schema/trunk/src/zope/schema/_field.py

...

> _isuri = re.compile(
> -    r"[a-zA-z0-9+.-]+:"   # scheme
> -    r"\S*$"               # non space (should be pickier)
> -    ).match
> +    # scheme
> +    r"[a-zA-z0-9+.-]+:"
> +    # non space (should be pickier)
> +    r"\S*$").match
> 
> +
> class URI(BytesLine):
>     """URI schema field
>     """
> @@ -589,9 +614,10 @@
> _isdotted = re.compile(
>     r"([a-zA-Z][a-zA-z0-9_]*)"
>     r"([.][a-zA-Z][a-zA-z0-9_]*)*"
> -    r"$" # use the whole line
> -    ).match
> +    # use the whole line
> +    r"$").match

Now, why would you do something like this?
It used to look like this:

_isuri = re.compile(
    r"[a-zA-z0-9+.-]+:"   # scheme
    r"\S*$"               # non space (should be pickier)
    ).match

_isdotted = re.compile(
    r"([a-zA-Z][a-zA-z0-9_]*)"
    r"([.][a-zA-Z][a-zA-z0-9_]*)*"
    r"$" # use the whole line
    ).match

1. The original code did not violate PEP-8 in any way.
2. You just made these regular expressions less readable.

   (a) comment on the same line as the regex part it describes is better
   (b) ).match on the separate line is better

Please revert this change.

What's the point of these whitespace changes anyway?



More information about the checkins mailing list