Hi, I would like to have the same function re.search(pattern, input) to keep
main code structure to be the same. The input into the re.search function will
be depended on other previous functions. It is also more dynamic for users.
Thank you.
___
Pytho
On Tue, 29 Sep 2020 at 04:39, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2020-09-28 at 23:10:24 -,
> Giang Le wrote:
>
> > I would like to propose an idea for the regular expression module
> > re.search(Pattern, Input) to support List[str] input type.
>
> > So it will return a matched
Hi, I would like to have the same function re.search(pattern, input) to
keep main code structure to be the same. The input into the re.search
function will be depended on other previous functions. It is also more
dynamic for users. Thank you.
___
Python-i
On 29/09/20 4:19 pm, Ben Rudiak-Gould wrote:
it's worth
mentioning that Haskell has tuples of length 0, 2, 3, ..., but no tuples
of length 1. Tuples are meant for putting n values where 1 value is
expected, and when n=1 you just put the value there.
To elaborate on that a bit, the length of a
Sorry if this isn't the right thread -- there's a few now.
But for an example of using both positional and keyword index parameters:
I maintain a library (gridded) that provides an abstraction over data on
various types of grid (in this case generally Oceanographic model output)
-- they can be re
On Sun, Sep 27, 2020 at 2:18 PM MRAB wrote:
> Consider, for example, the use-case of a function that has an optional
> parameter and you want a way to know whether an argument has been
> provided but None is a valid value that could be passed in.
>
> Having a singleton such as Missing would be he
On 2020-09-28 at 23:10:24 -,
Giang Le wrote:
> I would like to propose an idea for the regular expression module
> re.search(Pattern, Input) to support List[str] input type.
> So it will return a matched object list if the input is a string
> list. Otherwise, it will return a normal matched
Hi Everyone,
I would like to propose an idea for the regular expression module
re.search(Pattern, Input) to support List[str] input type.
So it will return a matched object list if the input is a string list.
Otherwise, it will return a normal matched object, if the input is a normal
string
Be
On Mon, 28 Sep 2020 at 15:45, Eric Wieser wrote:
>
> Would another option be to just stop using the tuple-less index in the
> presence of new syntax - so by example,
I don't think it would be a reliable approach. Now you end up with a
"randomly" occurring special case depending on how it's invok
On 2020-09-28 06:51, Chris Angelico wrote:
On Mon, Sep 28, 2020 at 3:33 PM Christopher Barker wrote:
As for using an empty tuple, thanks Guido for laying out the logic so succinctly, and it
does make it pretty simple that only the one index case is special. Nevertheless, I think
most folks ex
> The code which raises TypeError does not know whether it was called
internally by dict or set method or explicitly by hash
It's true, but I don't think it would be too hard to preserve some of the
context in some of those common cases. In that bug report, I suggested
adding an optional parameter
https://github.com/python/cpython/blame/master/Lib/unittest/test/testmock/testwith.py#L16
On Mon, Sep 28, 2020 at 12:00 PM Wes Turner wrote:
> `my_dict = (json.load(f) with open(filename.json, "r") as f)`
>
> Would that be called a generator expression / comprehension context
> manager?
>
> htt
`my_dict = (json.load(f) with open(filename.json, "r") as f)`
Would that be called a generator expression / comprehension context manager?
https://docs.python.org/3/reference/datamodel.html#context-managers
https://docs.python.org/3/library/contextlib.html
PEP 343 added the "with" statement.
T
On Mon, Sep 28, 2020 at 6:34 AM Samuel Freilich via Python-ideas <
python-ideas@python.org> wrote:
> The message does not include:
>
> * The word "hashable" verbatim, which appears in the glossary
>
* A link to https://docs.python.org/3/glossary.html#term-hashable
>
That's a pretty good entry tha
This reminds me of a previous proposal I can't remember if I hit the list with,
allowing
with open(filename.json, "r") as f:
my_dict = json.load(f)
to be spelt as a single expression:
my_dict = (json.load(f) with open(filename.json, "r") as f)
Obviously this would be more usefu
I can offer another example where the new syntax is likely to be of use to
numpy. We currently have the following as synonyms:
```
np.copyto(a, b, casting='unsafe')
a[...] = b
```
Obviously, it would be nice if we could allow other casting rules for `[]`
assignment:
```
np.copyto(a, b, casting='s
28.09.20 16:31, Samuel Freilich via Python-ideas пише:
> The error message for using a mutable sequence as a set item or map key
> seems to frequently confuse Python beginners. The current wording is:
>
{[1, 2, 3]: [4, 5, 6]}
> TypeError: unhashable type: 'list'
>
> The first thing a Google
Would another option be to just stop using the tuple-less index in the presence
of new syntax - so by example,
```
SYNTAXINDEX KWARGS
d[*[]]() {}
d[*[],] () {}
d[**{}] () {}
d[**{},] () {}
d[foo=1] () {'foo': 1}
d[foo=1,] () {'foo
The error message for using a mutable sequence as a set item or map key
seems to frequently confuse Python beginners. The current wording is:
>>> {[1, 2, 3]: [4, 5, 6]}
TypeError: unhashable type: 'list'
The first thing a Google search finds for "unhashable type" is ~4k Stack
Overflow results lik
19 matches
Mail list logo