Strange Python behaviour with regex module
Question: I have been playing around with the [improved regex
module](https://pypi.python.org/pypi/regex) for Python by Matthew Barnett and
found a strange error (behaviour? bug?).  
Consider the following code:

    
    
    import regex as re
    string = "liberty 123, equality 123, fraternity 123"
    rx = r'\d+(?=,|$)'
    results = re.findall(rx, string)
    print (results)
    

When invoked from the command line on my Mac (`python regex.py`), I get the
error `AttributeError: 'module' object has no attribute 'findall'`, while when
I copy and paste the exact same code to the python shell, it correctly outputs

    
    
    ['123', '123', '123']
    

Can somebody enlight me please? Is this some obvious thing I am missing here?


Answer: You must not name your modules identically to the system modules. Rename your
file `regex.py` to something else, like `my_regex.py`, then delete the file
`regex.pyc`, if it exists.

