question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider removing array constants

See original GitHub issue

I stumbled across this page, which lists four constants in the spec: e, inf, nan and pi.

I’m not strongly opposed, but it isn’t really clear to me why we need these in the spec when they already exist in Python’s builtin math built. Given that these should be builtin Python float objects, it isn’t clear to me what we gain from including these, except saving users another import?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
rgommerscommented, Mar 29, 2021

I could live with leaving these out, but personally lean towards leaving them in for convenience. And because I don’t like the math module much, would rather not rely on anything in the stdlib.

1reaction
rgommerscommented, May 6, 2021

We discussed this in a call today. @kkraus14 had a strong preference for keeping these constants in, because he wants to be able to implement them as a custom Python object that’s a singleton (and duck-types as a float, e.g. by implementing __float__). That way, once it’s on a GPU it can be reused there and this saves implicit syncs, compared to using math.pi et al.

Since no one is strongly opposed to keeping these constants in the API, that’s a good reason to stay with the status quo and keep them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove an element from an array in JavaScript
If you want to remove an element while leaving the original array intact (unmutated) then filter() is a good choice! Removing a single...
Read more >
Delete Element in Array Constant - NI Community
Easier ways to manipulate Array controls and constants has been asked for a few times. My workaround suggestion would be to change the...
Read more >
How to deleting const array in c++ [closed] - Stack Overflow
std::string::c_str returns a pointer to the internal char array of the string . It must not be deleted by the user because the...
Read more >
Removing Items from an Array in JavaScript - Ultimate Courses
To remove an item from array via its index, we'll first introduce the Array.prototype.splice method and then investigate a better pattern using ...
Read more >
Use array constants in array formulas - Microsoft Support
Use array constants in array formulas or by themselves to save time, ... An array constant nested in a SUM formula ... Delete...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found