Am 01.04.2020 15:01 schrieb Rhodri James:
I believe you do it in C as you would in Python: you call the Series
class!
pyseries = PyObject_CallObject((PyObject *)&series_type, NULL);
Well, that dumps core just as everything else I tried.
What does work, however, is calling PyType_Ready first
Hi guys,
I'm wondering how to create an instance of an extension class I wrote.
There's a minimal self-contained C module at the bottom of this post
which exports two things: 1) a class Series, and 2) a function
make_series() which is supposed to create a Series object on the C side
and retur
Hello,
either it's me or everybody else who's missing the point. I understand
the OP's proposal like this:
dict[set] == {k: dict[k] for k in set}
list[iterable] == [list[i] for i in iterable]
Am I right?
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 6 Mar 2020 20:06:40 -0700
Michael Torrie wrote:
> The documentation talks about writing files from
> disk, but I'm interested in creating these files from within Python
> directly in the zip archive.
But you have seen writestr(), haven't you?
ZipFile.writestr(zinfo_or_arcname, data, com
On Fri, 6 Mar 2020 20:06:40 -0700
Michael Torrie wrote:
> The documentation talks about writing files from
> disk, but I'm interested in creating these files from within Python
> directly in the zip archive.
But you have seen writestr(), haven't you?
ZipFile.writestr(zinfo_or_arcname, data, com
Am 25.02.2020 13:38 schrieb BlindAnagram:
and I am wondering if it is possible to use a class something like
class get_it(object):
seen = dict()
def __call__(piece):
return seen[piece]
What happened when you tried it?
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 19 Feb 2020 17:15:59 -0500
FilippoM wrote:
> How can I use Pandas' dataframe magic to calculate, for each of the
> possible 109 values, how many have VIDEO_OK, and how many have
> VIDEO_FAILURE I have respectively?
crosstab()
--
https://mail.python.org/mailman/listinfo/python-list
Thanks, Chris (and others), for the comprehensive answer (as usual). I
got interesting insights into Python's inner workings. Of course, when
everything is an object, everything has parents and other relatives, so
by traversing that tree in the right way one can make one's way all the
way to t
Am 21.01.2020 19:38 schrieb Chris Angelico:
On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker
wrote:
and even that the first id(mytup) returns the same address as the
second
one, I am left wondering exactly what immutability is.
Let's look at id()'s documentation:
id(object)
Return the
On Mon, 20 Jan 2020 06:43:41 +1100
Chris Angelico wrote:
> On Mon, Jan 20, 2020 at 4:43 AM wrote:
> > It works, but is it safe?
>
> As such? No.
That's what many people have said, and I believe them. But just from a
point of technical understanding: If I start with empty global and
local dic
Is it actually possible to build a "sandbox" around eval, permitting it
only to do some arithmetic and use some math functions, but no
filesystem acces or module imports?
I have an application that loads calculation recipes (a few lines of
variable assignments and arithmetic) from a database.
ex
On Sat, 11 Jan 2020 14:39:38 +0100
Friedrich Rentsch wrote:
> I'm pretty good at hacking html text. But I have no clue how to get
> dynamic data like this : "At close: {date} {time}". I would
> appreciate a starting push to narrow my focus, currently awfully
> unfocused. Thanks.
Focus on the st
On Wed, 18 Dec 2019 04:52:33 +1100
Chris Angelico wrote:
> On Wed, Dec 18, 2019 at 4:45 AM wrote:
> > BTW, the canonical way to upload files via http is PUT, not POST.
> > You might want to look into that, but here it is off-topic.
>
> Citation needed.
https://tools.ietf.org/html/rfc2616#pag
On Fri, 13 Dec 2019 11:34:24 +0100
Antoon Pardon wrote:
> Well if you really want to go this route, you may consider the
> following:
>
> def branch4(a, b, z):
> decision = [
> ((lambda: a > 4 and b == 0), "first"),
> ((lambda: len(z) < 2), "second"),
> ((lambda: b +
On Fri, 13 Dec 2019 03:54:53 +1100
Chris Angelico wrote:
> On Fri, Dec 13, 2019 at 3:44 AM Karthik Sharma
> wrote:
> >
> > Is it really possible to transfer a large binary file from my
> > machine to the above httpserver via POST command and download it
> > again? If yes, is the above Flask app
On Thu, 12 Dec 2019 11:33:25 +
Rhodri James wrote:
> On 11/12/2019 21:32, mus...@posteo.org wrote:
> > Plain and simple: When the refcount reaches zero.
> You are assuming that "when" implies "immediately on the occurence."
I'm not implying that. It's the dictionary definition of the word
Hi Chris,
The most important distinction, which that note is emphasizing, is
that the "del" statement removes just one reference, and if there are
other references, then __del__ will not be called.
No argument there, that's how reference counting works, and it's clear
from the docs. What is n
On Tue, 10 Dec 2019 22:08:48 +0100
"R.Wieser" wrote:
> And although you have been fighting me over when the __del__ method is
> called, it /is/ called directly as a result of an "del instance" and
> the refcount goes zero. There is /no/ delay.(with the only
> exception is when a circular ref
On Tue, 10 Dec 2019 14:56:10 -0500
Dennis Lee Bieber wrote:
>
> It is called when the language IMPLEMENTATION decides to call
> it. That time is not specified in the language description/reference
> manual.
Yes it is:
"Note: del x doesn’t directly call x.__del__() — the former decrements
Am 11.12.2019 11:22 schrieb R.Wieser:
I think I will just go out on a limb and just assume that the __del__
method
/will/ be called as part of a "del instance" request causing the
reference
count to reach zero (directly or indirectly), before the next command
is
executed [...].
That's what
Am 11.12.2019 11:01 schrieb Greg Ewing:
On 11/12/19 7:47 am, R.Wieser wrote:
what happens when the reference becomes zero: is the __del__
method called directly (as I find logical), or is it only called when
the
garbage collector actually removes the instance from memory (which
Chris
thinks w
Am 10.12.2019 22:33 schrieb Paul Moore:
You do understand that the reference counting garbage collector is an
implementation detail of the CPython implementation *only*, don't you?
I don't think that's true. Here's a sentonce from near the top of the
"gc" module documentation of Python 3:
ht
Hello Neil,
thanks for the detailed answer.
Question: are there other people/factors who/which should be regarded
as more important than the linter's opinion?
Yes. Mine.
I was just puzzled at the linter's output (took me a while to figure out
what it actually meant), and that got me started
I like it! I think it's a cute exercise but it doesn't really solve any
problem. The if/elif chain can accomplish the same thing (and much more)
in the same line count for the price of being clunkier. **D
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
I have a function with a long if/elif chain that sets a couple of
variables according to a bunch of test expressions, similar to function
branch1() below. I never liked that approach much because it is clumsy
and repetetive, and pylint thinks so as well. I've come up with two
alternati
On Sun, 1 Dec 2019 01:33:50 -0800 (PST)
John Ladasky wrote:
> The only thing I must install with pip is tensorflow-gpu. For
> everything else, I make use of the Ubuntu repositories. The Synaptic
> package manager installs packages (including Python modules) for all
> user accounts at the same t
I've successfully built and installed a copy of Python3.6.8 (replacing a
probably buggy installation on my RHEL system, different story). Also I
set up a virtualenv by doing "$ /usr/local/bin/python3.6dm -m venv
/usr/local/pyenv36"
In my activated virtualenv, I try "$ pip install numpy" but it
27 matches
Mail list logo