Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

f-strings supported only on some devices
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

f-strings supported only on some devices

by bludin on Fri Jun 12, 2020 5:35 am

I have a an itsybitsy M4, a trinket M0 and a serpente, all running cp5.3. f-strings work fine on the itsybitsy but generate a syntax error on the trinket and the serpente. Is that expected? I would have thought that cp of a certain version is the same on all devices expect for hardware-specific differences...

bludin
 
Posts: 20
Joined: Thu Apr 16, 2020 8:57 am

Re: f-strings supported only on some devices

by dastels on Fri Jun 12, 2020 11:43 am

As of 5.1:
Support for “f-strings”, a more convenient way to build strings dynamically. It is enabled on almost all boards except those with SAMD21 microcontrollers.


The SAMD21 MCUs have significantly less memory (flash and RAM) than the SAMD51 or nRF52840 MCUs, hence they run a somewhat stripped down version of CircuitPython.

Dave

dastels
 
Posts: 2829
Joined: Tue Oct 20, 2015 3:22 pm

Re: f-strings supported only on some devices

by bludin on Sat Jun 13, 2020 5:38 am

Thanks for the info, that's good to know.
Is this documented somewhere and/or is there a simple way to find out what general features (i.e. not hardware-specific stuff) is implemented on which platform?
And can I count on existing features to be implemented equally on different platforms? I'm playing around with exec and eval functions at the moment and find that they behave somewhat different from CPython with respect to scope/namespaces. That's fine with me, but if possible; I would like the code to be portable between different cp platforms.

Thanks a lot for your help! It highly appreciated.

bludin
 
Posts: 20
Joined: Thu Apr 16, 2020 8:57 am

Re: f-strings supported only on some devices

by dastels on Sun Jun 14, 2020 3:31 pm

In terms of modules: https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html. I don't see anything about f-strings as it is language-level and nbot module-level; it will be controlled by build flags. Most of the variation will be at the module level.

Dave

dastels
 
Posts: 2829
Joined: Tue Oct 20, 2015 3:22 pm

Re: f-strings supported only on some devices

by tannewt on Mon Jun 15, 2020 5:20 pm

bludin wrote:Is this documented somewhere and/or is there a simple way to find out what general features (i.e. not hardware-specific stuff) is implemented on which platform?


The support matrix covers most differences across boards.

bludin wrote:And can I count on existing features to be implemented equally on different platforms? I'm playing around with exec and eval functions at the moment and find that they behave somewhat different from CPython with respect to scope/namespaces. That's fine with me, but if possible; I would like the code to be portable between different cp platforms.


Please file issues with any CPython incompatibilities. We want to be as compatible as possible.

Generally, we're out of space on the SAMD21 so no new features will be added. Almost all other platforms will receive new work.

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.