[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Wolfgang Maier

Wolfgang Maier added the comment:

> Ah. Something like self._interpolation.before_get(self, section, option, 
> value, d) could be better written as 
> self._interpolation.before_get(parser=self, ...)

Yep, that's roughly what I was trying to explain.

> I still don't grock the apparent 'get()' signature mis-match however.

There is not much special here either. RawConfigParser inherits from 
MutableMapping, which in turn inherits from Mapping, which defines a get 
method, which RawConfigParser overwrites. The overwritten and the overwriting 
method *do* have different parameters, but I don't see why that matters.

In general, this does not look like a topic for the Python bug tracker (you are 
not reporting a bug, but you try to understand how correctly working code does 
its job), but rather for news:comp.lang.python or a PyCharm mailing list.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Richard Prosser

Richard Prosser added the comment:

Ah. Something like self._interpolation.before_get(self, section, option, value, 
d) could be better written as self._interpolation.before_get(parser=self, ...) 
- but that would require keyword arguments to be used throughout.

I still don't grock the apparent 'get()' signature mis-match however.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Richard Prosser

Richard Prosser added the comment:

Thanks for the prompt reply. I still don't fully understand yet but there 
aren't any errors reported so I presume that it is OK.

There is another related matter however: PyCharm (2016.2.3) indicates that a 
get() method signature does not match that of the Mapping class one ...

557
558class RawConfigParser(MutableMapping):

761
762def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):


There are other similar cases I believe.

So I am not sure what to make of that, either.

--
hgrepos: +363

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Wolfgang Maier

Wolfgang Maier added the comment:

Ah, that's kind of confusing at first!

the 'self' in the method calls (like on line 796) refers to the ConfigParser 
instance and will be bound to the parser parameter. The first parameter, the 
'self' in the interpolation method definition, is not provided as usual because 
the method is called on an _interpolation instance. => Nothing special here 
except the names of the arguments

--
nosy: +wolma
type: compile error -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Richard Prosser

New submission from Richard Prosser:

>From https://hg.python.org/cpython/file/3.5/Lib/configparser.py (for example):

358class Interpolation:
359"""Dummy interpolation that passes the value through with no changes."""
360
361def before_get(self, parser, section, option, value, defaults):
362return value

but a typical invocation misses out the 'parser' parameter:

796return self._interpolation.before_get(self, section, option, 
value,
797  d)

As far as I can see, this is not a keyword-only parameter, yet PyCharm seems to 
treat it as one. So maybe this is some new behaviour that I don't understand 
yet but there seems to be a fault here, IMO.

I am using Python 3.5.2 on Windows 7, after using the 'futurize' tool on some 
legacy 2.7 code that extended self._interpolate (which no longer exists in 3+).

--
hgrepos: 362
messages: 281697
nosy: rprosser
priority: normal
severity: normal
status: open
title: configparser: before_get() method of class Interpolation has positional 
'parser' parameter that is not used.
type: compile error
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com