mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

#limit

0 posts0 participants0 posts today
Replied in thread

@looopTools

Fair enough. Because recursion always has a limit, in any language, the tutorials probably assume you're aware of this already. The specific limit in Python is adjustable, but there's no way to eliminate it altogether.

Do the tutorials actually include data/examples that run into the recursion limit? Or is it only when applying code like that to other data that you run into issues?

I ask because the easiest way to smash the limit is to create a cyclic data structure, which is trivial in Python. If you naively recurse such an object, it goes on forever - until it hits the configured limit or the machine runs out of memory, anyways. i.e. this case:

>>> foo = ["bar"]
>>> foo.append(foo)
>>> foo
['bar', [...]]

If you think it's possible your recursion code might have to deal with something like this, you usually end up keeping track of the objects you've already processed, and skip them if you see the same object again (typically by the object ID).

In many cases, you can also rewrite recursive code so that it's not recursive, and cannot run into this problem. As a bonus, problems that can be refactored this way usually run faster without the recursion.

Hit an interesting limit in the TypeScript language server¹:

Looks like there’s a limit on the number of entries an object (constant) can have before the language server balks. Seems to hit it around 1,343.

(I’m generating an object for an icon library.)

Doesn’t appear to be related to file/memory size (breaking up the same number of entries into several objects works).

Anyone know what limitation exactly I’m hitting (if it’s documented somewhere?) Been searching but couldn’t find any reference to it.

¹ It’s definitely a language server limit as I tried in VSCode as well to rule out it being a limit in Helix Editor.

There’s a theoretical limit to how tall a tree can grow, and it’s about 426 feet (130 meters).

Why? Because trees rely on capillary action and water tension to pull water up from their roots to their leaves. At a certain height, gravity overcomes the tree’s ability to transport water effectively, causing water columns to break and leading to air bubbles (embolism) in their vascular system. The tallest known tree, Hyperion, is a redwood in California, is 379.7 feet (115.9 meters).

What's the post character count limit for your instance on Mastodon?

Meaning, when you make a post here on Mastodon, how many characters per post can you type?

For example, currently #AllThingsTech has the default Mastodon 500 character count limit.

If your instance has more than a 1,000 character count limit, please comment and let me know.

Please BOOST for maximum exposure to the #Fediverse

#Poll#Polls#POTD