Skip to content

Conversation

@dlech
Copy link
Member

@dlech dlech commented Jul 19, 2025

Enable f-strings on level 2 hubs. This is a very useful feature, but also big, so we only enable it on level 2 hubs.

On the one had, having differences between hubs can cause confusion, but on the other hand, f-strings are really nice to have.

We already have some precedence of handling strings a bit different on level 2 hubs (example) so this could be explained along with those other differences.

Enable f-strings on level 2 hubs. This is a very useful feature, but
also big, so we only enable it on level 2 hubs.
@coveralls
Copy link

Coverage Status

coverage: 57.466%. remained the same
when pulling 2495fd5 on dlech:fstring-support
into 96cdd12 on pybricks:master.

@laurensvalk
Copy link
Member

On the one had, having differences between hubs can cause confusion

They already work in mpy-cross compiled scripts, just not on the REPL.

You can run this on Technic Hub today:

world = "123"

print(f"Hello, {world}")

but on the other hand, f-strings are really nice to have.

Besides the REPL (where using f-strings should be relatively rare), what are the additional things we could now do?

@BertLindeman
Copy link
Contributor

Besides the REPL (where using f-strings should be relatively rare), what are the additional things we could now do?

In micropython f-strings in the REPL are not widely implemented.
Sometimes you want to do a quick test in the REPL and then bump into: no f-strings.
It is more important to have f-strings on all hubs, but the REPL could do without I think.

But like David states, nice to have.
(Hm, rather not so helpful remark, sorry)

@dlech
Copy link
Member Author

dlech commented Jul 24, 2025

Besides the REPL (where using f-strings should be relatively rare), what are the additional things we could now do?

I was using paste-mode on the REPL since we don't have download and run on the EV3 yet.

If we ever get a "real" file system and people can load .py files rather than just .mpy, then this would be useful as well.

Not urgent though.

@laurensvalk
Copy link
Member

Besides the REPL (where using f-strings should be relatively rare), what are the additional things we could now do?

If we ever get a "real" file system and people can load .py files rather than just .mpy, then this would be useful as well.

Not urgent though.

Makes sense. So let's defer until we need it.

I was using paste-mode on the REPL since we don't have download and run on the EV3 yet.

It's fine to enable it on EV3 to make development easier if we keep tabs on what needs disabling later (just like the debug port.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants