[Yum-devel] [PATCH 1/2] add misc.parse_pattern()

Nils Philippsen nils at redhat.com
Tue Jan 10 14:08:18 UTC 2012


A bit late, but...

On Mon, 2011-12-19 at 17:13 +0100, Zdeněk Pavlas wrote:
> +def parse_pattern(pattern):
> +    """ Split a string to a list of package or group patterns.
> +    """
> +    assert type(pattern) == str

... this strikes me as odd in two ways:

1) why check for the exact type, and not use isinstance?
2) why use 'str' and exclude 'unicode', as groups are translated and can
therefore be non-ASCII? The 'you groups' command works right now with
parameters with accents in them for instance (not sure whether this
would be affected or not, just for illustration):

        root at gibraltar:~> LC_ALL=de_DE.UTF-8 yum groups info 'Bücher und
        Anleitungen'
        Geladene Plugins: presto
        Einrichten des Gruppenprozess
        
        Gruppe: Bücher und Anleitungen
         Beschreibung: Bücher und Anleitungen für Fedorabenutzer und
        Entwickler
         Standard-Pakete:
           diveintopython
           javanotes
           ldd-pdf

Nils

> +    return [s.strip() for s in pattern.split(',')]

-- 
Nils Philippsen      "Those who would give up Essential Liberty to purchase 
Red Hat               a little Temporary Safety, deserve neither Liberty
nils at redhat.com       nor Safety."  --  Benjamin Franklin, 1759
PGP fingerprint:      C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011



More information about the Yum-devel mailing list