Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PyScript glitches #7

Open
almarklein opened this issue Mar 21, 2018 · 2 comments
Open

PyScript glitches #7

almarklein opened this issue Mar 21, 2018 · 2 comments

Comments

@almarklein
Copy link
Member

almarklein commented Mar 21, 2018

@almarklein commented on Tue Jan 03 2017

This is an issue to collect "glitches" in PyScript, because it's so easy to forget about them. We'll have to see whether to fix or document each one individually.


@Winand commented on Sun Jul 02 2017

(as of v0.4.1) pyscript allows def catch(): (fixed in #17)
and this = ... and produces invalid js

The latter is still possible, because a user might still want to use this explicitly, and we only check use of names (not assignments) at this point.


@Winand commented on Fri Jul 07 2017

class Translator():
    langs, q = {}, None

produces invalid js source (variables are defined globally):

stub2_ = [{}, null];
langs = stub2_[0];q = stub2_[1];
@Mahadevv01
Copy link

Issue: PyScript Glitches

I’ve reviewed the listed issues and would like to contribute the following observations:

  1. if x with x as an object resolving to False:

    • This occurs when the object has a length property, leading to unexpected behavior. A potential fix could involve refining the truthy() function to handle objects more accurately.
  2. x = x or 0:

    • This behavior might be due to the way truthy() processes non-truthy values. Perhaps a conditional check could be added to prevent this from failing.
  3. elif this_is_js() Syntax Error:

  4. range() Bringing in pyfunc_range():

    • This could be optimized by conditionally importing pyfunc_range() only when needed, not just within for loops.
  5. assert x Does Not Use truthy():

    • The assertion might need an update to utilize truthy() for consistency across PyScript.
  6. List Comprehensions with Float64Array:

    • It appears that list comprehensions aren’t fully compatible with Float64Array. Fixing this would involve ensuring the correct type handling within the comprehension logic.

Next Steps:

I’m interested in working on some of these issues. Should I create separate pull requests for each, or would you prefer one comprehensive PR?

Looking forward to your feedback!

@almarklein
Copy link
Member Author

Thanks! I'd prefer small pr's for individual fixes.

I am happy to review and merge incoming pr's, but note that PScript is not very actively developed, so you should decide how much time you think is worth to 'investing' in this project :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants