[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-14 Thread Martin Panter

Martin Panter added the comment:

Nicholas, there is Issue 8706 about converting functions and methods to accept 
keywords in general.

There is also the slash “/” indicator proposed by PEP 457, which is used for 
some functions in pydoc; bytes.replace() for instance. In Issue 23738 I was 
trying to get some consensus on using this slash notation in the main 
documentation, in which case bytes.translate() could look like

bytes.translate(table, delete=b"", /)

And there is Issue 21314 about where to document the slash notation that is 
already used in pydoc.

--
nosy: +martin.panter
superseder:  -> accept keyword arguments on most base type methods and builtins

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-12 Thread Nicholas Chammas

Nicholas Chammas added the comment:

Yep, you're right. I'm just understanding now that we have lots of methods 
defined in C which have signatures like this.

Is there an umbrella issue, perhaps, that covers adding support for 
keyword-based arguments to functions defined in C, like `translate()`?

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is a known, generic issue with c-coded functions.  Some C functions have 
been converted, especially those with boolean parameters, and especially those 
with multiple boolean parameters.

I think, but an not sure, that / is sometimes used to signal that the preceding 
are position only, and that this may have something to do with ArgumentClinic.  
I also would like a consistent indication.  But this may be a duplicate issue.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread Nicholas Chammas

Nicholas Chammas added the comment:

So you're saying if `bytes.translate()` accepted keyword arguments, its 
signature would look something like this?

```
bytes.translate(table, delete=None)
```

I guess I was under the mistaken assumption that argument names in the docs 
always matched keyword arguments in the signature.

But you're right, a strictly positional argument (I guess specified via 
something like `args*`?) doesn't have a name.

--

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread SilentGhost

SilentGhost added the comment:

I don't think docs suggest that in any way. The keyword arguments are typically 
described like this: https://docs.python.org/3/library/stdtypes.html#str.split

bytes.translate has a typical signature of a function with optional positional 
arguments.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread Nicholas Chammas

New submission from Nicholas Chammas:

The docs for `bytes.translate()` [0] show the following signature:

```
bytes.translate(table[, delete])
```

However, calling this method with keyword arguments yields:

```
>>> b''.translate(table='la table', delete=b'delete')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: translate() takes no keyword arguments
```

I'm guessing other methods have this same issue. (e.g. `str.translate()`)

Do the docs need to be updated, or should these methods be updated to accept 
keyword arguments, or something else?

[0] https://docs.python.org/3/library/stdtypes.html#bytes.translate

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 260034
nosy: Nicholas Chammas, docs@python
priority: normal
severity: normal
status: open
title: bytes.translate() doesn't take keyword arguments; docs suggests it does
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