The main clause differentiating bad, weaponizable CoCs from good ones is
"Assume good faith"
Everything will be OK if good faith can reasonably be assumed (E.g. when
someone uses a word which is only offensive based on context)
On the other hand, e.g. obvious racial slurs never have a place on a
in jinja, you can do “{{ 'foo' if bar }}”.
it evaluates to “'foo'” or an empty string (differently to python’s
formatting, “None” expands to an empty string in jinja)
similarly I often do “thing = 'foo' if bar else None” and it would be nice
if i could shorten that by making “else None” implicit.
sorry, it’s a bit more difficult. this works:
https://gist.github.com/flying-sheep/86dfcc1bdd71a33fa3483b83e254084c
Philipp A. schrieb am Do., 7. Sep. 2017 um 21:18 Uhr:
> Sadly it’s hard to create a context manager that skips its body like this:
>
> with unpack(computation())
Sadly it’s hard to create a context manager that skips its body like this:
with unpack(computation()) as result:
do_something_with_result(result)
You can do it with some hackery like described here:
https://stackoverflow.com/a/12594789/247482
class unpack:
def __init__(self, pred):
A progmatic workaround for yourself:
https://addons.mozilla.org/de/firefox/addon/py3direct/
https://chrome.google.com/webstore/detail/py3redirect/codfjigcljdnlklcaopdciclmmdandig
Bar Harel schrieb am Do., 7. Sep. 2017 um 07:52 Uhr:
> A bit radical but do you believe we can contact Google to alte
Ram Rachum schrieb am Mo., 27. März 2017 um 16:42 Uhr:
> Another idea: Maybe make json.load and json.dump support Path objects?
>
yes, all string-path expecting stdlib APIs should support PEP 519
https://www.python.org/dev/peps/pep-0519/
___
Python-id
the same is true for files: Deciding to iterate them line-wise is
relatively arbitrary, byte/char-wise would be equally intitive. So
something could be chosen.
But I think being explicit in the case of paths is really not that
inconvenient.
Serhiy Storchaka schrieb am So., 26. Feb. 2017 um
16:
How about adding a new argument to with_suffix?
Path.with_suffix(suffix: str,
stripped: Union[int, str, Iterable[str]]=1)
stripped would either receive an int (in which case it will greedily strip
up to that many suffixes), or a (optionally compound) suffix which would be
strippe
Hi George,
While the old “let’s treat strings as paths” modules are split up like you
said, pathlib can do what they do and more:
https://docs.python.org/3/library/pathlib.html
It’s also prettier and easier to use, especially when using autocompletion
(just type “path.is” and see what you can tes
Hi Python Ideas,
And merry christmas!
Once upon a time – in August this year – I started a (somewhat badly
titled) thread about improving the f-string grammar:
https://mail.python.org/pipermail/python-ideas/2016-August/041727.html
Luckily it resulted in an interim grammar change that invalidated
Hi Guido, thanks for calling me out.
Yikes, I'm terribly sorry that it came over that way!
I'll write the RFC. Should I expand the existing one (this would need
Chris’ pending changes though) or write a new one?
My goals were to sound factual and terse, not to insult anyone. And I don't
see the
scription of the way they work for Python users.
Best, Philipp
Chris Angelico schrieb am Di., 30. Aug. 2016, 15:43:
> On Tue, Aug 30, 2016 at 10:56 PM, Philipp A. wrote:
> > My issue is just that it’s as much of a string as a call of a (string
> > returning) function/method or
Hi Eric,
Very cool of you to get this going!
I hope the outcome is to ban escapes within braced code parts of f-literals
for 3.6 and add them “the right way” in 3.7: f'foo{ bar['\n'] }baz'
It really is how things work in every single language that i ever
encountered that has template literals /
Eric V. Smith schrieb am Di., 30. Aug. 2016 um
14:13 Uhr:
> There's debate on if that's the right way, and I personally think it's
> probably not. Personally, I'd be happy with the only change being to not
> allow backslashes inside braces. But that's not an argument that I'm
> willing to get int
Sorry for replying to late, i had an email issue.
First two important things: 1. mental model and intuition and 2.
precendence.
About how to think of them: I’m strongly of the opinion that the mental
models of either an alternating sequence of strings and formatted
expressions, or a string with
Hi, I originially posted this via google groups, which didn’t make it
through to the list proper, sorry! Read it here please:
https://groups.google.com/forum/#!topic/python-ideas/V1U6DGL5J1s
My arguments are basically:
1. f-literals are semantically not strings, but expressions.
2. Their es
16 matches
Mail list logo