classification
Title: Compiled regexes don't show all attributes in dir()
Type: enhancement Stage: resolved
Components: Regular Expressions Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dwt, ezio.melotti
Priority: normal Keywords:

Created on 2011-12-14 08:13 by dwt, last changed 2011-12-14 13:22 by ezio.melotti. This issue is now closed.

Messages (3)
msg149428 - (view) Author: Martin Häcker (dwt) Date: 2011-12-14 08:13
When looking at a regex with dir() you don't get all available attributes - which is inconvenient as some very important ones (like .pattern) are not visible.

To demonstrate:

> import re
> re.compile('foo').pattern
'foo'
> dir(re.compile('foo'))

['__copy__',
 '__deepcopy__',
 'findall',
 'finditer',
 'match',
 'scanner',
 'search',
 'split',
 'sub',
 'subn']
msg149432 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-12-14 09:06
This seems already fixed in 2.7.2+/3.2/3.3, what version have you tried?
msg149440 - (view) Author: Martin Häcker (dwt) Date: 2011-12-14 11:08
Indeed, I'm on version

% python --version
Python 2.7.1


Sorry.
History
Date User Action Args
2011-12-14 13:22:31ezio.melottisetstage: resolved
2011-12-14 11:08:54dwtsetstatus: pending -> closed

messages: + msg149440
2011-12-14 09:06:27ezio.melottisetstatus: open -> pending
type: enhancement
resolution: out of date
messages: + msg149432
2011-12-14 08:13:45dwtcreate