$ python
Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18)
[GCC 10.1.1 20200718] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {1:2}
>>> c = {1:2, 3:4}
>>> c.keys() - a.keys()
{3}
>>>
Why not frozenset({3})?
--
https://mail.python.org/ma
On Tue, 4 Jan 2022 at 19:38, Chris Angelico wrote:
> [...] should the keys view be considered
> frozen or not? Remember the set of keys can change (when the
> underlying dict changes).
Well, also the items can change, but they are returned as tuples with
2 elements.
It seems to me that the stdli
On Wed, 5 Jan 2022 at 00:54, Chris Angelico wrote:
> That's because a tuple is the correct data type when returning two
> distinct items. It's not a list that has two elements in it; it's a
> tuple of (key, value). Immutability is irrelevant.
Immutability is irrelevant, speed no. A tuple is faste
On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote:
> That's an entirely invisible optimization, but it's more than just
> "frozenset is faster than set". It's that a frozenset or tuple can be
> stored as a function's constants, which is a massive difference.
Can you explain this?
> In fact, the
I have a custom implementation of dict using a C extension. All works but
the pickling of views and iter types. Python segfaults if I try to pickle
them.
For example, I have:
static PyTypeObject PyFrozenDictIterKey_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"frozendict.keyiterator",
On Wed, 5 Jan 2022 at 23:02, Chris Angelico wrote:
>
> On Thu, Jan 6, 2022 at 8:01 AM Marco Sulla
> wrote:
> >
> > On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote:
> > > That's an entirely invisible optimization, but it's more than just
> >
>> 12 POP_BLOCK
>> 14 LOAD_CONST 0 (None)
16 RETURN_VALUE
On Tue, 11 Jan 2022 at 01:05, Chris Angelico wrote:
> On Tue, Jan 11, 2022 at 10:26 AM Marco Sulla
> wrote:
> >
> > On Wed, 5 Jan 2022 at 23:02, Chris Angelico wrote
Found. I simply forgot:
if (PyType_Ready(&PyFrozenDictIterKey_Type) < 0) {
goto fail;
}
in the frozendict_exec function for the module.
On Fri, 7 Jan 2022 at 20:27, Marco Sulla
wrote:
> I have a custom implementation of dict using a C extension. All works but
>
Sorry for being maybe a little OT. I tried to get help from other Conda
users, from chat and from the mailing list without success.
I would add a custom build on my conda package. Is there somewhere a doc or
an example about it?
(Specifically, I want to pass a custom parameter to the setup.py tha
Thank you a lot for letting me understand :)
On Tue, 11 Jan 2022 at 22:09, Peter J. Holzer wrote:
> On 2022-01-11 19:49:20 +0100, Marco Sulla wrote:
> > I think this is what you mean:
> >
> > >>> dis.dis("for _ in {1, 2}: pass")
> > 1
On Mon, 24 Jan 2022 at 05:37, Dennis Lee Bieber wrote:
> Note that the comparison warns that /indexing/ in pandas can be slow.
> If your manipulation is always "apply operationX to columnY" it should be
> okay -- but "apply operationX to the nth row of columnY", and repeat for
> other rows
Well, this is more or less what I'm trying to do.
I have an immutable object. I would have copy.deepcopy() will return the
object itself if it's hashable. If not, it must return a deepcopy of it.
So I tried to implement a __deepcopy__ for the object. It segfaults if the
object is not hashable. An
and I had to Py_INCREF(memo)! Thank you A LOT!
On Mon, 31 Jan 2022 at 23:01, Chris Angelico wrote:
> On Tue, 1 Feb 2022 at 08:54, Marco Sulla
> wrote:
> > PyObject* d = PyDict_New();
> > args = PyTuple_New(2);
> > PyTuple_SET_ITEM(args, 0, d);
> >
Just out of curiosity: why dict.setdefault() has the default parameter
that well, has a default value (None)? I used setdefault in the past,
but I always specified a value. What's the use case of setting None by
default?
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 2 Feb 2022 at 14:34, Lars Liedtke wrote:
>
> This is a quite philosophical queston if you look at it in general:
> "What value do you give a variable, that is not set?"
Maybe I expressed my question badly. My existential doubt is why
setdefault has an optional parameter for the value and
You could add a __del__ that calls stop :)
On Wed, 2 Feb 2022 at 21:23, Cecil Westerhof via Python-list
wrote:
>
> I need (sometimes) to repeatedly execute a function. For this I wrote
> the below class. What do you think about it?
> from threading import Timer
>
>
>
> class repeated_tim
These are a lot of questions. I hope we're not off topic.
I don't know if mine are best practices. I can tell what I try to do.
On Tue, 8 Feb 2022 at 15:15, Lars Liedtke wrote:
> - On a line per line basis? on a function/method basis?
I usually log the start and end of functions. I could also lo
On Wed, 9 Feb 2022 at 20:40, Martin Di Paola wrote:
>
> If the logs are meant to be read by my users I log high level messages,
> specially before parts that can take a while (like the classic
> "Loading...").
? Logs are not intended to be read by end users. Logs are primarily
used to understand
I agree with Chris. I don't know if it was already written: if you
want a local function for speed reasons, you can use the classic
approach of a main function.
--
https://mail.python.org/mailman/listinfo/python-list
Narshad, I propose you post your questions to StackOverflow. I'm sure
they will be very happy.
--
https://mail.python.org/mailman/listinfo/python-list
Maybe you compiled Python 2.7 by hand, David? It happened to me when I
tried to compile Python without zlib headers installed on my OS. Don't
know how it can be done on Windows.
--
https://mail.python.org/mailman/listinfo/python-list
I noticed that some functions inside dictobject.c that call insertdict
or PyDict_SetItem do an incref of key and value before the call, and a
decref after it. An example is dict_merge. Other functions, such as
_PyDict_FromKeys, don't do an incref before.
When an incref of key and value is needed b
On Sat, 5 Mar 2022 at 17:36, Barry Scott wrote:
> Note: you usually cannot use pip when building an RPM with mock as the
> network is disabled inside the build for
> security reasons.
Can't he previously download the packages and run pip on the local packages?
--
https://mail.python.org/mailman
On Sun, 6 Mar 2022 at 03:20, Inada Naoki wrote:
> In general, when reference is borrowed from a caller, the reference is
> available during the API.
> But merge_dict borrows reference of key/value from other dict, not caller.
> [...]
> Again, insertdict takes the reference. So _PyDict_FromKeys() *
So my laziness pays. I use only LTS distros, and I update only when
there are security updates.
PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
end-of-life. I prefer lightweight debian-like distros.
On Tue, 8 Mar 2022 at 19:56, Ethan Furman wrote:
>
> https://arstechnica.com/
As title. dict can't be an immortal object, but hashable frozendict
and frozenmap can. I think this can increase their usefulness.
Another advantage: frozen dataclass will be really immutable if they
could use a frozen(dict|map) instead of a dict as __dict__
--
https://mail.python.org/mailman/lis
On Wed, 9 Mar 2022 at 23:28, Martin Di Paola wrote:
> Think in the immutable strings (str). What would happen with a program
> that does heavy parsing? I imagine that it will generate thousands of
> little strings. If those are immortal, the program will fill its memory
> very quickly as the GC wi
On Thu, 10 Mar 2022 at 04:50, Michael Torrie wrote:
>
> On 3/9/22 13:05, Marco Sulla wrote:
> > So my laziness pays. I use only LTS distros, and I update only when
> > there are security updates.
> > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
&
On Thu, 10 Mar 2022 at 14:13, Jack Dangler wrote:
> or why not get a cloud desktop running whatever distro you want and you
> don't have to do anything
Three reasons: privacy, speed, price. Not in this order.
On Thu, 10 Mar 2022 at 15:20, Chris Angelico wrote:
> Very easy. I use Debian with Xfc
On Fri, 11 Mar 2022 at 06:38, Dan Stromberg wrote:
> That's an attribute of your desktop environment, not the Linux distribution.
>
> EG: I'm using Debian with Cinnamon, which does support ctrl-alt-t.
Never used Cinnamon. It comes from Mint, right?
> Some folks say the desktop environment matter
On Fri, 11 Mar 2022 at 19:10, Michael Torrie wrote:
> Both Debian stable and Ubuntu LTS state they have a five year support
> life cycle.
Yes, but it seems that official security support in Debian ends after
three years:
"Debian LTS is not handled by the Debian security team, but by a
separate g
think about? Here is the python code:
https://github.com/Marco-Sulla/python-frozendict/blob/35611f4cd869383678104dc94f82aa636c20eb24/frozendict/src/3_10/frozendictobject.c#L652-L697
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 14 Mar 2022 at 18:33, Loris Bennett wrote:
> I am not sure how different the two situations are. Ubuntu is
> presumably relying on the Debian security team as well as other
> volunteers and at least one company, namely Canonical.
So do you think that Canonical contributes to the LTS secu
On Sat, 12 Mar 2022 at 22:37, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> Once hashing an object fails, why would an application try again? I can
> see an application using a hashable value in a hashable situation again
> and again and again (i.e., taking advantage of the cache), but what's
> th
On Wed, 16 Mar 2022 at 00:42, Cameron Simpson wrote:
>
> Is it sensible to compute the hash only from the immutable parts?
> Bearing in mind that usually you need an equality function as well and
> it may have the same stability issues.
[...]
> In that case I would be inclined to never raise Typ
On Wed, 16 Mar 2022 at 00:59, Chris Angelico wrote:
>
> (Though it's a little confusing; a frozendict has to have nothing but
> immutable objects, yet it permits them to be unhashable?
It can have mutable objects. For example, a key k can have a list v as
value. You can modify v, but you can't as
On Wed, 16 Mar 2022 at 09:11, Chris Angelico wrote:
> Caching the hash of a
> string is very useful; caching the hash of a tuple, not so much; again
> quoting from the CPython source code:
>
> /* Tests have shown that it's not worth to cache the hash value, see
>https://bugs.python.org/issue96
On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote:
> They are are about a year apart, so they will usually contain different
> versions of most packages right from the start. So the Ubuntu and Debian
> security teams probably can't benefit much from each other.
Are you sure? Since LTS of Debian
Dirty suggestion: stderr?
On Thu, 31 Mar 2022 at 18:38, Cecil Westerhof via Python-list
wrote:
>
> In Python when the output of a script is going to a pipe stdout is
> buffered. When sending output to tee that is very inconvenient.
>
> We can set PYTHONUNBUFFERED, but then stdout is always unbuff
On Thu, 31 Mar 2022 at 18:38, Cecil Westerhof via Python-list
wrote:
> Most people think that
> Ubuntu is that also, because it is based on Debian. But Ubuntu wants
> also provide the newest versions of software and this will affect the
> stability and security negatively.
I think you're referrin
A proposal. Very often dict are used as a deeply nested carrier of
data, usually decoded from JSON. Sometimes I needed to get some of
this data, something like this:
data["users"][0]["address"]["street"]
What about something like this instead?
data.get_deep("users", 0, "address", "street")
and
On Sun, 3 Apr 2022 at 16:59, Kirill Ratkin via Python-list
wrote:
>
> Hi Marco.
>
> Recently I met same issue. A service I intergated with was documented
> badly and sent ... unpredictable jsons.
>
> And pattern matching helped me in first solution. (later I switched to
> Pydantic models)
>
> For
On Sun, 3 Apr 2022 at 18:57, Dieter Maurer wrote:
> You know you can easily implement this yourself -- in your own
> `dict` subclass.
Well, of course, but the question is if such a method is worth to be
builtin, in a world imbued with JSON. I suppose your answer is no.
--
https://mail.python.org
On Sun, 3 Apr 2022 at 21:46, Peter J. Holzer wrote:
>
> > > data.get_deep("users", 0, "address", "street", default="second star")
>
> Yep. Did that, too. Plus pass the final result through a function before
> returning it.
I didn't understand. Have you added a func parameter?
> I'm not sure whet
On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote:
> They are are about a year apart, so they will usually contain different
> versions of most packages right from the start. So the Ubuntu and Debian
> security teams probably can't benefit much from each other.
Well, this is what my updater on
On Wed, 13 Apr 2022 at 20:05, Peter J. Holzer wrote:
>
> On 2022-04-12 21:03:00 +0200, Marco Sulla wrote:
> > On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote:
> > > They are are about a year apart, so they will usually contain different
> > > versions of most
On Thu, 14 Apr 2022 at 19:16, MRAB wrote:
>
> When you're working only with dates, timedelta not having a 'days'
> attribute would be annoying, especially when you consider that a day is
> usually 24 hours, but sometimes 23 or 25 hours (DST).
I agree. Furthermore, timedelta is, well, a time delta
On Sat, 16 Apr 2022 at 10:15, Peter J. Holzer wrote:
> It doesn't (or at least you can't conclude that from the evidence you
> posted).
>
> There is a subdirectory called "debian" in the build directory of every
> .deb package. This is true on Debian, Ubuntu and every other
> distribution which us
>>> 10**26 - 1
99
>>> 1e26 - 1
1e+26
Why?
--
https://mail.python.org/mailman/listinfo/python-list
Excuse me, I forgot to include the python list mail addess. I repost the mail.
On Fri, Sep 2, 2016 at 6:18 PM, Christian Gollwitzer wrote:
> 1e26 denotes a *floating point number* Floating point has finite precision,
> in CPython it is a 64bit IEEE number. The largest exact integer there is
>
On 2 September 2016 at 21:12, Christian Gollwitzer wrote:
> Am 02.09.16 um 19:24 schrieb Marco Sulla:
> Because Python has no long double type?
Python no of course, but C++ yes, and CPython is written in C++.
However, I think the answer is here:
https://en.wikipedia.org/wiki/Long_
On 3 September 2016 at 02:31, Marco Sulla
wrote:
> Python no of course, but C++ yes, and CPython is written in C++.
Sorry, I just founded CppPython...
--
https://mail.python.org/mailman/listinfo/python-list
On 6 August 2016 at 23:33, Ian Kelly wrote:
> On Aug 6, 2016 2:10 PM, "Marco Sulla via Python-list" <
> python-list@python.org> wrote:
>
>
> Yes, I was thinking manly to SQL. That furthermore is NOT a
> programming language.
>
>
> Why not? It'
>
> I encounter with cases like doing a function 6 time with no argument, or
> same arguments over and over or doing some structral thing N times and I
> dont know how elegant I can express that to the code.
>
??? Excuse me, but why you needed to call the same function SIX times? This
seems to me
On Fri, 13 Mar 2020 at 20:06, pro_ bro wrote:
> First of all sry for asking this type of question.
> I started my Python journey a year ago. From then I learned a lot(Basics to
> advanced topics )
Can I ask you what had motivated you?
> never took me into the python stream after getting placed i
It's a know bug. Solution: https://stackoverflow.com/a/59909885/1763602
--
https://mail.python.org/mailman/listinfo/python-list
Well, I suppose we have a winner:
pyperf_bench_3_8_gcc_9_2.json
=
Performance version: 1.0.0
Report on Linux-4.15.0-76-generic-x86_64-with-glibc2.27
Number of logical CPUs: 4
Start date: 2020-03-13 19:36:17.585796
End date: 2020-03-13 20:35:09.605718
pyperf_bench_3_8_
https://docs.python.org/3/library/profile.html#pstats.Stats.print_callers
On Sat, 14 Mar 2020 at 00:54, Go Luhng wrote:
> Consider a simple call graph: `main()` calls `foo()`, which calls
> `bar()`. Then `main()` calls `qux()` which also calls `bar()`, but
> with different parameters.
>
> When y
'email': 'fal...@ibm.com'
}
d & ("first_name", "last_name") == {'first_name': 'Frances',
'last_name': 'Allen'}
https://github.com/Marco-Sulla/python-frozendict/commit/b2628e14f3275c6ba488dde220023c14f6a843
On Tue, 17 Mar 2020 at 08:36, Greg Ewing wrote:
>
> On 4/03/20 12:52 pm, Marco Sulla wrote:
> > Why can't an asynchronous coroutine be simply a coroutine that has an
> > `async` or an `await` in its code, without `async` in the signature?
>
> That wouldn't help
TL;DR: I tried to implement in CPython a frozendict here:
https://github.com/Marco-Sulla/cpython
Long explaining:
What is a frozendict? It's an immutable dict. The type was proposed in
the past but rejected: https://www.python.org/dev/peps/pep-0416/
So why did I try to implement it? IMO,
On Mon, 13 Jul 2020 at 19:28, Barry Scott wrote:
> > On 13 Jul 2020, at 03:20, Marco Sulla wrote:
> > So why did I try to implement it? IMO, apart the considerations in PEP
> > 416, a frozendict can be useful:
> >
> > - as a faster base for types.MutableMapping
On Wed, 15 Jul 2020 at 08:07, Inada Naoki wrote:
> I don't think so. The view objects are useful when we need a set-like
> operation. (e.g. `assert d.keys() == {"spam", "egg"}`)
Yes, but, instead of creating a view, you can create and cache the
pointer of a "real" object, that implements the dic
On Thu, 16 Jul 2020 at 06:11, Inada Naoki wrote:
> On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
> wrote:
> > Yes, but, instead of creating a view, you can create and cache the
> > pointer of a "real" object, that implements the dict view API.
> > For example,
On Fri, 17 Jul 2020 at 04:13, Inada Naoki wrote:
> > 3. many python internals uses a mapping proxy to a dict, to avoid its
> > modification. A frozendict can be used instead.
>
> Are they used frequently in performance critical path?
> Could you point some concrete examples?
I searched a little i
I noticed that iterating over a dictionary seems quite slower than creating
an iterator and iterating over it. Maybe I miss something?
marco@buzz:~/sources/cpython$ ./python dict_bench.py
Name: `for x in dict`; Size:8; Time: 1.091e-07
Name: `for x in dict`; Size: 1000; Time:
On Sat, 18 Jul 2020 at 10:02, Inada Naoki wrote:
> On Sat, Jul 18, 2020 at 7:05 AM Marco Sulla
> wrote:
> > For what I know, CPython uses PyDictObject for kwargs. Since dicts are
> > mutable, it's a problem to cache them properly.
>
> On caller side, Python doesn
... oh my ... Sure, thank you.
Thinking positive, I wasted a lot of hours, but I discovered
timeit.Timer.autorange
On Sat, 18 Jul 2020 at 23:30, Chris Angelico wrote:
> On Sun, Jul 19, 2020 at 7:20 AM Marco Sulla
> wrote:
> >
> > I noticed that iterating over a dictionary
ittle speedup in iteration.
Here's the code:
https://github.com/Marco-Sulla/cpython/commit/8d6c7f727a55d9d922c8a3a755fcb6c68ed26197
The benchmark output:
Name: `constructor(d)`; Size:8; Keys: int; Type:
dict; Time: 2.956e-07
Name: `constructor(d)`; Size:8; Keys
On Tue, 21 Jul 2020 at 06:01, Inada Naoki wrote:
> On Tue, Jul 21, 2020 at 5:07 AM Marco Sulla wrote:
> >
> > I just finished to improve the performance of frozendict creation. The
> result is very promising.
> >
> > The speedup is about 30% for small dicts
After building CPython from source, I run the regression test suite, using
make test (I'm on Linux).
Now I would run only some tests, and pass a custom option (-R :)
I tried
TESTOPTS="test_pickle" make test
without success. I had to do:
./python -u -bb -E -Wd -m test -r --fail-env-changed -w -j 0
What you want is a branch, I guess.
https://www.mercurial-scm.org/wiki/Branch
For simplicity, I suggest you have two different directories: one for the
development branch and the other for the production branch.
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 7 Aug 2020 at 17:14, Christian Seberino wrote:
> This is an interesting observation. I've heard people say the fact that
> Python has both expressions and statements is a negative. (Lisp only
> has expressions.)
Commonly, in imperative languages like C, you can write
if (a = b) {...}
About statement vs expression: maybe you, Richard and
2QdxY4RzWzUUiLuE, are right, maybe not. This is hard to say, since the
official C documentation is not public and you have to pay a small fee
to obtain it.
Anyway, I said "in C, the assignment is a statement that can be used
in expression". You
On Fri, 7 Aug 2020 at 18:48, Chris Angelico wrote:
> Tail call optimization (there's no reason to restrict it to recursion
> alone) is something a Python implementation could choose to do, but
> the trouble is that full optimization tends to destroy traceback
> information
Indeed this is implemen
On Fri, 7 Aug 2020 at 19:48, Richard Damon wrote:
> The difference is that the two languages define 'expression' differently.
> [...]
I don't know if this is interesting or pertinent to the topic.
Christian Seberino just expressed a doubt about how a clear separation
between a statement and an
On Fri, 7 Aug 2020 at 19:41, Christian Seberino wrote:
> I think this is really significant point why more syntax does necessarily
> mean less readability.
I don't think so. Readability of programming languages was measured
using an objective method, and Python was one of the most readable.
The
On Fri, 7 Aug 2020 at 22:35, Terry Reedy wrote:
> This is a common misconception. Linear iteration and tail recursion are
> equivalent. The issue is calculating values once versus multiple times.
> Here is the fast recursion equivalent to the fast iteration.
>
> def fib(n, pair=(1,0)):
> p
Let me first say that I don't know if my post is on topic with the
mailing list. If so, please inform me.
My idea seems to be very simple (so probably it's not simple at all):
a language similar to Python, but statically compiled.
(Yes, I know Cython, RPython, Julia, Rust...)
Since I've not grea
On Sat, 8 Aug 2020 at 00:28, Richard Damon wrote:
> The really interesting part is that since Lisp programs manipulate lists
> as data, and the program is just a list, Lisp programs have the
> theoretical ability to edit themselves (assuming the implementation give
> access to the list of the prog
On Sat, 8 Aug 2020 at 03:46, Christian Seberino wrote:
> >> Readability of programming languages was measured
> >> using an objective method, and Python was one of
> >> the most readable.
>
> Do you have a source for this?
This question means you have not read at all my suggestions :-D
Anyway, th
On Sat, 8 Aug 2020 at 14:10, Barry wrote:
> >> On 7 Aug 2020, at 23:28, Marco Sulla wrote:
> > My idea seems to be very simple (so probably it's not simple at all):
> > a language similar to Python, but statically compiled.
>
> Have a look at Appleās Swift. It r
On Sun, 9 Aug 2020 at 10:31, Barry Scott wrote:
> By going to C you are really saying you want to use the native instructions
> of your CPU.
> Contrast that with bytecode that needs an interpreter.
This is also an answer for Grant Edwards: the idea was to generate
bytecode and compile it to mach
assert(The set that contains everything is God)
Compile with -OO
On Mon, 10 Aug 2020 at 13:23, haael wrote:
>
>
> Forgive me if this has already been discussed.
>
>
> Could we add the idea of "negative" sets to Python? That means sets that
> contain EVERYTHING EXCEPT certain elements.
>
>
> Fir
This seems to work:
from types import SimpleNamespace
from collections.abc import Iterable
def isIterableNotStr(arg):
return isinstance(arg, Iterable) and not isinstance(arg, str)
class DeepNamespace(SimpleNamespace):
def namespacesFromIterable(self, arg):
vals = []
chang
https://www.google.com/search?channel=fs&client=ubuntu&q=publish+python+code
First result.
--
https://mail.python.org/mailman/listinfo/python-list
@Chris: you're very right, but, I repeat, you can't have a real TCO
(asyncio apart):
(venv_3_10) marco@buzz:~$ python
Python 3.10.0a0 (heads/master-dirty:ba18c0b13b, Aug 14 2020, 17:52:45)
[GCC 10.1.1 20200718] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def
Sorry, didn't read well, Apart the other suggestion, you (or your
sysop) can create a private Pypi:
https://pypi.org/project/private-pypi/
--
https://mail.python.org/mailman/listinfo/python-list
As title. The reasons that came in my mind are:
1. speed
2. security
--
https://mail.python.org/mailman/listinfo/python-list
Are you sure you want `str()`?
>>> str(b'aaa')
"b'aaa'"
Probably you want:
map(lambda x: x.decode(), bbb)
--
https://mail.python.org/mailman/listinfo/python-list
I do not know poetry, but it seems it uses virtual environments, so I
suppose it's quite more simple if you run
poetry shell
and install and run all you need.
--
https://mail.python.org/mailman/listinfo/python-list
If you want to avoid float problems, you can use Decimal:
https://docs.python.org/3/library/decimal.html
On Wed, 7 Oct 2020 at 05:23, Meghna Karkera wrote:
>
> How is PYTHON better than other software's(MATLAB) in case of truncation or
> rounding off error.
>
> Thanks
> Meghna
> --
> https://mai
You can also, and this is the preferred way, install it in the venv
and use it in the venv.
When you activate the venv shell, you can `pip install` anything you
want. The packages will be installed inside the venv, and you don't
need any PYTHONUSERBASE or PYTHONPATH. The venv already manages this.
In __init__.py, you can parse the toml file, extract the version and
store it in a __version__ variable.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 7 Oct 2020 at 14:16, Loris Bennett wrote:
> But the toml file isn't part of the distribution and so it won't be
> installed.
>
> I suppose I could write a separate program which parses the toml file
> and then just injects the version into __init__.py.
Yes, I do not know poetry, but I sup
He should also calculate the carbon dioxide emitted by brains that
works in C++ only. I omit other sources.
--
https://mail.python.org/mailman/listinfo/python-list
Another way is:
'{:%Y-%m-%d %H:%M}'.format(d2)
--
https://mail.python.org/mailman/listinfo/python-list
The first time I started python I simply followed the official tutorial:
https://docs.python.org/3.9/tutorial/introduction.html
PS: Note that this is for Python 3.9. You can change the version in the
page if you have another one.
--
https://mail.python.org/mailman/listinfo/python-list
I tried this code:
static PyObject *
frozendict_reduce(PyFrozenDictObject* mp, PyObject *Py_UNUSED(ignored))
{
PyObject* args = PyTuple_New(1);
if (args == NULL) {
return NULL;
}
PyTuple_SET_ITEM(args, 0, (PyObject *)mp);
PyObject *d = PyObject_Call((PyObject *)&PyDi
On Tue, 20 Oct 2020 at 16:07, Serhiy Storchaka wrote:
> You can use PyDict_New() + PyDict_Merge() to create a dict from your
> mapping.
>
Well, yes, I know. I just wrote it for simplicity now. Do you think this is
the problem?
I forgot to say that copy and deepcopy works. For what I know, they u
101 - 200 of 263 matches
Mail list logo