This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients ariel_bruner, terry.reedy
Date 2013-07-26.22:10:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374876630.69.0.338682752377.issue18539@psf.upfronthosting.co.za>
In-reply-to
Content
If you are the same 'ariel' as on SO, thank you for the detective work and the informative report here. Without it this 2.7-only bug would be low priority and might have sat open until we stopped patching 2.7.

The underlying issue is that a) 2.x had the 'feature' of allowing tuples of parameter names to signal automatic unpacking of tuples of arguments, and b) the unnamed tuple got a pseudoname of the form '.n' in the list of argument names, which calltips uses.

>>> def f((a,b), (c,d)): pass
>>> f.func_code.co_varnames
('.0', '.1', 'a', 'b', 'c', 'd')

Issue #791968 added the following line to change '.n' to '<tuple>'.
arg_text = "(%s)" % re.sub("\.\d+", "<tuple>", arg_text)
But this also changes float strings of form 'm.n' to 'm<tuple>'. The solution is to recognize the difference between the absence and presence of a preceding digit and not do the substitution in the latter case. Adding the negative lookbehind assertion (?<![0-9]) makes
  def f((a,b), c=0.0): 
produce (<tuple>, c=0.0). I am preparing a patch, including the test.
History
Date User Action Args
2013-07-26 22:10:30terry.reedysetrecipients: + terry.reedy, ariel_bruner
2013-07-26 22:10:30terry.reedysetmessageid: <1374876630.69.0.338682752377.issue18539@psf.upfronthosting.co.za>
2013-07-26 22:10:30terry.reedylinkissue18539 messages
2013-07-26 22:10:30terry.reedycreate