[issue14991] Option for regex groupdict() to show only matching names

2016-10-16 Thread Matthew Barnett
Matthew Barnett added the comment: I'd prefer an explicit suppression to changing a long-standing behaviour. -- ___ Python tracker ___ ___

[issue14991] Option for regex groupdict() to show only matching names

2016-10-16 Thread Ned Deily
Ned Deily added the comment: How do others feel about Serhiy's proposal for eventually changing the semantics of groupdict() to mean only return matched groups? If that seems reasonable, then there is the separate question of how to make the transition. Adding a somewhat unpredictable Future

[issue14991] Option for regex groupdict() to show only matching names

2016-10-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed patch makes groupdict() without argument emitting FutureWarning if the result includes unmatched groups. Maybe warning message and the documentation could be better. Ned, I ask your permission for including this change in 3.6. Yes, it can break thi

[issue14991] Option for regex groupdict() to show only matching names

2016-10-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Maybe start emitting FutureWarning when groupdict() is called without an argument? groupdict(None) returns the same result but without a warning. After 1 or 2 releases the behavior can be changed: groupdict() will return only matched groups. -- nosy

[issue14991] Option for regex groupdict() to show only matching names

2012-06-17 Thread Larry Hastings
Larry Hastings added the comment: @mrabarnett: That's right--except your tense is wrong. mo.groupdict() has supported the "default" parameter since the function was first added, way back in 1.5.2. -- ___ Python tracker

[issue14991] Option for regex groupdict() to show only matching names

2012-06-17 Thread Matthew Barnett
Matthew Barnett added the comment: @rhettinger: The problem with "nodefault" is that it's negative, so that "nodefault=False" means that you don't not want the default, if you see what I mean. I think that "suppress" would be better: mo.groupdict(suppress=True) @larry: If the parameter w

[issue14991] Option for regex groupdict() to show only matching names

2012-06-16 Thread Larry Hastings
Larry Hastings added the comment: Just a thought--how about a new constant in the re module: SUPPRESSED=object() and have the interface be mo.groupdict(default=re.SUPPRESSED) -- nosy: +larry ___ Python tracker

[issue14991] Option for regex groupdict() to show only matching names

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett stage: -> needs patch ___ Python tracker ___ __

[issue14991] Option for regex groupdict() to show only matching names

2012-06-03 Thread Raymond Hettinger
New submission from Raymond Hettinger : Currently, mo.groupdict() always inserts a default value for unmatched named groups. This is helpful in some use cases and awkward in others. I propose adding an option to suppress default entries: >>> # CURRENT WAY >>> pattern = r'(?PMrs |Mr |Dr )?(?P