Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A rolling disk gathers no MOS.


devel / comp.lang.python / Certification in PYTHON

SubjectAuthor
* Re: Best practice for caching hashCameron Simpson
`- Certification in PYTHONBhavesh Kunar

1
Re: Best practice for caching hash

<mailman.313.1647399545.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17522&group=comp.lang.python#17522

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: Best practice for caching hash
Date: Wed, 16 Mar 2022 13:58:53 +1100
Lines: 62
Message-ID: <mailman.313.1647399545.2329.python-list@python.org>
References: <CAPTjJmreW-t5ggSg+Re_Rvw7yf9RRLp_mav_8pGej-zrfwoAhw@mail.gmail.com>
<YjFSbUEVy4rdttsp@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de g0dLFjg6gTQ1TAvAt87bVAAhS38h1oraTECh7IjocX+A==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'everyone,': 0.03;
'traceback': 0.04; 'error:': 0.05; 'angelico': 0.09; 'compute':
0.09; 'example:': 0.09; 'likewise': 0.09; 'objects,': 0.09;
'tags': 0.09; 'unlike': 0.09; 'yes.': 0.09; 'cheers,': 0.11;
'memory': 0.15; 'that.': 0.15; '(it': 0.16; 'caching': 0.16;
'cameron': 0.16; 'cases,': 0.16; 'dict': 0.16; 'dicts': 0.16;
'exception.': 0.16; 'flexibility.': 0.16; 'from:addr:cs': 0.16;
'from:addr:cskk.id.au': 0.16; 'from:name:cameron simpson': 0.16;
'hash': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'objective':
0.16; 'reason.': 0.16; 'received:13.237': 0.16;
'received:13.237.201': 0.16; 'received:13.237.201.189': 0.16;
'received:cskk.id.au': 0.16; 'received:id.au': 0.16;
'received:mail.cskk.id.au': 0.16; 'reference,': 0.16; 'sensible':
0.16; 'simpson': 0.16; 'such,': 0.16; 'tuple': 0.16; 'tuples':
0.16; 'varied': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'python':
0.16; 'values': 0.17; 'to:addr:python-list': 0.20; 'exception':
0.22; 'maybe': 0.22; 'idea': 0.24; 'anything': 0.25; 'object':
0.26; "isn't": 0.27; 'leave': 0.27; 'function': 0.27; 'chris':
0.28; 'wrong': 0.28; 'error': 0.29; 'header:User-Agent:1': 0.30;
'raise': 0.31; 'think': 0.32; 'here,': 0.32; 'issues.': 0.32;
'objects': 0.32; 'but': 0.32; "i'm": 0.33; 'subject:for': 0.33;
'same': 0.34; 'header:In-Reply-To:1': 0.34; 'received:au': 0.35;
'cases': 0.36; 'work,': 0.36; 'those': 0.36; 'way': 0.38; 'quite':
0.39; 'valid': 0.39; 'exact': 0.40; 'skip:h 10': 0.61; 'above':
0.62; 'reasonable': 0.62; 'internal': 0.63; 'simply': 0.63;
'received:13': 0.64; 'widely': 0.64; 'similar': 0.65; 'well':
0.65; 'received:userid': 0.66; 'numbers': 0.67; 'bad': 0.67;
'entire': 0.67; 'accept': 0.67; 'latter': 0.69; 'type:': 0.69;
'times': 0.69; 'relevant': 0.73; 'associates': 0.76; 'subsequent':
0.76; 'effective': 0.78; 'significant': 0.78; 'database': 0.80;
'seek': 0.81; 'penalty': 0.84; 'stability': 0.84; 'stable,': 0.84;
'badly': 0.91; 'cheap': 0.91; 'alive.': 0.93; 'former': 0.93;
'mind,': 0.93; 'details,': 0.95
Mail-Followup-To: Python List <python-list@python.org>
Content-Disposition: inline
In-Reply-To: <CAPTjJmreW-t5ggSg+Re_Rvw7yf9RRLp_mav_8pGej-zrfwoAhw@mail.gmail.com>
User-Agent: Mutt/2.2.1 (2022-02-19)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <YjFSbUEVy4rdttsp@cskk.homeip.net>
X-Mailman-Original-References: <CAPTjJmreW-t5ggSg+Re_Rvw7yf9RRLp_mav_8pGej-zrfwoAhw@mail.gmail.com>
 by: Cameron Simpson - Wed, 16 Mar 2022 02:58 UTC

On 16Mar2022 10:57, Chris Angelico <rosuav@gmail.com> 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.
>
>My understanding - and I'm sure Marco will correct me if I'm wrong
>here - is that this behaves like a tuple: if it contains nothing but
>hashable objects, it is itself hashable, but if it contains anything
>unhashable, the entire tuple isn't hashable.

A significant difference is that tuples have no keys, unlike a dict.

A hash does not have to hash all the internal state, ony the relevant
state, and not even all of that. The objective of the hash is twofold to
my mind:
- that "equal" objects (in the `==` sense) have the same hash, so that
they hash to the same backet in dicts and can therefore be found
- that hash values are widely distributed, to maximise the evenness of
the object distribution in buckets

For dicts to work, the former has to hold.

The latter has more flexibility. A dict has keys. If the dicts are quite
varied (sets of tags for example), it may be effective to just hash the
keys. But if the dict keys are similar (labelled CSV-rows-as-dicts, or
likewise with database rows) this will go badly because the hashes will
all (or maybe mostly) collide.

>As such, any valid hash value will be stable, and "asking for a hash
>will raise TypeError" is also stable.

I would seek to avoid a TypeError for a frozendict, but as you can see
above I have not thought of a way to do that which would also have
desireable hash characteristics in almost all circumstances. (I think we
can accept that almost anything will have pathological cases, but the
bad cases in my hash-the-keys notion are not, to my mind, rare.)

>> >The problem is the first time I get an error with details, for example:
>> >TypeError: unhashable type: 'list'
>> >The subsequent times I simply raise a generic error:
>> >TypeError
>>
>> You could, you know, cache the original exception. That does keep links
>> to the traceback and therefore all the associates stack frames, so that
>> isn't cheap (it is peerfectly fast - just the reference, t just prevents
>> those things from being reclaimed).
>
>I don't like that idea myself, for that exact reason - it'll keep
>arbitrary numbers of objects alive.

I don't like it either, for that exact reason. That reason is the same
reason which has Python 3 exception variables get unset as you leave an
`except` clause. I'm sure it irks everyone, but the memory penalty of
not doing so is high.

>But caching the stringified form
>would be more reasonable here, and have similar effect.

Mmm, yes.

Cheers,
Cameron Simpson <cs@cskk.id.au>

Certification in PYTHON

<90f1207b-9e93-4545-916f-59023f6f4213n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17526&group=comp.lang.python#17526

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a05:620a:2487:b0:67b:3113:f83f with SMTP id i7-20020a05620a248700b0067b3113f83fmr20187158qkn.604.1647408441929;
Tue, 15 Mar 2022 22:27:21 -0700 (PDT)
X-Received: by 2002:a05:622a:1309:b0:2e1:cc2f:3738 with SMTP id
v9-20020a05622a130900b002e1cc2f3738mr13538380qtk.655.1647408441731; Tue, 15
Mar 2022 22:27:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Tue, 15 Mar 2022 22:27:21 -0700 (PDT)
In-Reply-To: <mailman.313.1647399545.2329.python-list@python.org>
Injection-Info: google-groups.googlegroups.com; posting-host=183.82.119.180; posting-account=krDOfgoAAACPRuGkCcQsTfFxwLsD6InU
NNTP-Posting-Host: 183.82.119.180
References: <YjFSbUEVy4rdttsp@cskk.homeip.net> <CAPTjJmreW-t5ggSg+Re_Rvw7yf9RRLp_mav_8pGej-zrfwoAhw@mail.gmail.com>
<mailman.313.1647399545.2329.python-list@python.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <90f1207b-9e93-4545-916f-59023f6f4213n@googlegroups.com>
Subject: Certification in PYTHON
From: bhav...@techlearn.live (Bhavesh Kunar)
Injection-Date: Wed, 16 Mar 2022 05:27:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 16
 by: Bhavesh Kunar - Wed, 16 Mar 2022 05:27 UTC

I have learned Python from TechLearn's Free Course and mastered my skills in python from Basics to professionals. This course is a great introduction to both fundamental programming concepts and the Python programming language. By the end, you’ll be comfortable programming in Python and taking your skills off the TechLearn platform and onto your own computer.

Course link - https://www.techlearn.live/course/python-programming-for-beginnersutm_source=GoogleGroups&utm_medium=Organic+Social&utm_campaign=GG16.03.2022

After learning from TechLearn e-learning Platform. I was able to make this few projects on my own
1. Check Voting Eligibility of a citizen
2. Calculating the total distance travelled for ZoomCar
3. Created an expense tracker using Python
4. To Find number of students who failed using Python
I got Mentor Support, Practice Notebooks & Certificate of Completion

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor