>AFAICT, it's not nothing at all to do with 'xor' in any sense.
As much as I agree that the function needn't be in the base of python, I
can easily follow the OP's logic on the function name.
With two items in the iterator, it is a standard binary exclusive or.
It is true if one of but not both
I don't think an exclusive-or/truthy-entries-count-checker needs to be a
builtin by any stretch.
>>> def xor( iterable, n = 1 ):
... return sum( map( bool, iterable ) ) == n
Or if you insist on short circuiting:
>>> def xor_ss( iterable, n = 1 ):
... for intermediate in itertools.accumulat
1 (vv)
is effectively locked/atomic on post-3.10 interpreters, though this is
neither portable nor guaranteed to stay that way into the future
On Sun, Feb 26, 2023 at 10:19 PM Michael Speer wrote:
> I wanted to provide an example that your claimed atomicity is simply
> wrong, but I found there is
I wanted to provide an example that your claimed atomicity is simply wrong,
but I found there is something different in the 3.10+ cpython
implementations.
I've tested the code at the bottom of this message using a few docker
python images, and it appears there is a difference starting in 3.10.0
p
Python doesn't care what an expression returns.
You've written an expression that returns the value of the 'clear' function
that is bound to that particular list.
The interpreter doesn't know or care if accessing that 'clear' attribute on
the class returns a function or for some reason triggers a
>Well, the value is productivity. No need to save puzzles "what this
>hanging else belongs to?"
if you get to the point where it's hard to tell which else lines up with
which if or for statement, I would suggest breaking things out into
well-named helper functions rather than worrying over orderin
pkg/graph.py:
from graphing_module_b import plot, axis
pkg/foobar.py:
from .graph import plot, axis
Would it be sufficient to use a file for indirection?
On Thu, Sep 5, 2019 at 7:11 PM Rob Gaddi
wrote:
> I'm trying to figure out how to rename an import globally for an entire
> packa
You may want to use `#!/usr/bin/env python3` instead.
There is a concept in python called the virtual environment. This used to
be done with a tool called virtualenv in python2, and is now done mainly
through a venv module in python3.
A virtual environment goes into a directory of your choosing a
> "/usr/sbin/ftpasswd" "--hash"
You're missing a comma, and python automatically concatenates adjacent
strings.
On Tue, Oct 15, 2013 at 1:13 PM, Florian Lindner wrote:
> Hello,
>
> I have a 3rd party perl script:
>
> head -n 1 /usr/sbin/ftpasswd
> #!/usr/bin/perl
>
> I want to write data to s
By his reasoning it simply shouldn't exist. Instead you would access the
information only like this:
with open("myfile.dat") as f:
data = f.read()
Which is my preferred way to work with resources requiring cleanup in
python anyways, as it ensures I have the least chance of messing things up,
an
ers to it.
Load up your interpreter and play with it interactively. Remember the
dir( object ) command will give a full listing of the attributes of
any given object. Looking at object.__doc__ will give you the
documentation. There's probably something in there to hide the window
if that
I posted this to my blog at
http://michaelspeer.blogspot.com/2007/11/context-manager-for-temporary.html.
I decided to forward it onto the list for comments. I thought someone
might find it interesting.
***
This is very much a fragile hack at the moment. It's an interesting
idea I think. I was d
#x27;\\': return LAMBDAARGS;
}
to PyToken_TwoChars.
The interactive runtime requires the OneChar definition, and the compilation
process ( specifically pgen ) requires the TwoChar definition.
If anyone wants the changes required to play around with it just email me
and I'll
13 matches
Mail list logo