[Tutor] How does the interpreter determine how many decimal places to display for a float?
boB Stepp
robertvstepp at gmail.com
Sun May 16 12:48:53 EDT 2021
On Sun, May 16, 2021 at 10:35 AM Peter Otten <__peter__ at web.de> wrote:
>
> On 15/05/2021 20:45, boB Stepp wrote:
> > On Sat, May 15, 2021 at 3:38 AM Peter Otten <__peter__ at web.de> wrote:
> >>
> >> On 15/05/2021 05:29, boB Stepp wrote:
> While the last step may be a bit harder the general recipe is very
> simple: start a some point and jump from function call to function
> definition until you have found the actual operation you are interested
> in. You can professionalize this and use a debugger or an IDE feature,
> but just grep -- and print() when you are really lost -- is not much slower.
This is helpful. However, I tend to (so far) be clumsy in finding a
decent starting point. Since your original reply I have been poking
around the cpython source and am getting a better handle on how it is
arranged. Hopefully this will help me in the future.
> "dtoa" = ? Decimal to ASCII?
> > I would have never suspected I should look here.
> >
> > I have not studied C. Looking over the referenced source code, why
> > do C programmers use such cryptic acronyms for their naming?
>
> As Alan hints, the short "cryptic" names are likely the old ones, and
> there are only a few ones that are or were heavily used. Most of the
> functions in the CPython source have descriptive names. Because there
> are no namespaces names even tend to get too long for readable code.
Hmm. This makes me wonder if even a person such as myself might be
able to contribute to Python by renaming "cryptic" old-style C-naming
with more modern descriptive names? I wonder how many many files
would be involved in such a project to just clean up the naming in
dtoa.c? But I don't have time now to do such, but I can see it as
something I might be able to do. Just a stray thought...
Thanks, Peter,
boB Stepp
More information about the Tutor
mailing list