[issue8177] Incoherent error with keyword argument follow by unpacking argument lists

2010-03-19 Thread Ghislain Hivon

New submission from Ghislain Hivon :

Take a fonction with a parameter and  *args
def foo(bar, args*)
  pass

then call it like this
myargs = [1, 2, 3, 4, 5]
foo(bar=1, *myargs)

The call produce this error : 
TypeError: foo() got multiple values for keyword argument 'bar'

Sould the error be more like : 
SyntaxError: non-keyword arg after keyword arg

the same error if foo was called like this : 
foo(bar=1, myargs)
or
foo(bar=1, 1, 2, 3, 4, 5)

--
components: Interpreter Core
messages: 101332
nosy: GhislainHivon
severity: normal
status: open
title: Incoherent error with  keyword argument follow by unpacking argument 
lists
versions: Python 2.5, Python 2.6, Python 3.1

___
Python tracker 
<http://bugs.python.org/issue8177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8177] Incoherent error with keyword argument follow by unpacking argument lists

2010-03-21 Thread Ghislain Hivon

Ghislain Hivon  added the comment:

The reverse, f(*(1, 2, 3), foo=4), is consistent with 
f(1,2,3, foo=4)
who also gave 
TypeError: f() got multiple values for keyword argument 'foo'

Which is consistent with the tutorial
http://docs.python.org/tutorial/controlflow.html#keyword-arguments

def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
...
but the following calls would all be invalid:
parrot(voltage=5.0, 'dead')  # non-keyword argument following keyword
parrot(110, voltage=220) # duplicate value for argument

--

___
Python tracker 
<http://bugs.python.org/issue8177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17829] csv.Sniffer.snif doesn't set up the dialect properly for a csv created with dialect=csv.excel_tab and containing quote (") char

2013-04-24 Thread Ghislain Hivon

New submission from Ghislain Hivon:

When sniffing the dialect of a file created with the csv module with 
dialect=csv.excel_tab and one of the row contain a quote ("), the delimiter is 
set to ' ' instead of '\t'.

--
files: csv_sniffing_excel_tab.py
messages: 187709
nosy: GhislainHivon
priority: normal
severity: normal
status: open
title: csv.Sniffer.snif doesn't set up the dialect properly for a csv created 
with dialect=csv.excel_tab and containing quote (") char
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file30001/csv_sniffing_excel_tab.py

___
Python tracker 
<http://bugs.python.org/issue17829>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com