Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Not to mark jupyter magic command as a problem #3251

Closed
XJTLUmedia opened this issue Aug 27, 2022 · 4 comments
Closed

Not to mark jupyter magic command as a problem #3251

XJTLUmedia opened this issue Aug 27, 2022 · 4 comments
Assignees
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@XJTLUmedia
Copy link

XJTLUmedia commented Aug 27, 2022

Using environments: VSCode 1.70.0
Python 3.10.6
Pylance v2022.8.41

If I run code below

from random import random
def estimate_pi(n=1e7) -> "area":
    """Estimate pi with monte carlo simulation.
    
    Arguments:
        n: number of simulations
    """
    in_circle = 0
    total = n
    
    while n != 0:
        prec_x = random()
        prec_y = random()
        if pow(prec_x, 2) + pow(prec_y, 2) <= 1:
            in_circle += 1 # inside the circle
        n -= 1
        
    return 4 * in_circle / total

%time estimate_pi()

tt1
ttt

There is a problem on %time

Remove all problems notification on magic command of jupyter notebook. But not python

@debonte
Copy link
Contributor

debonte commented Aug 27, 2022

Triage: Magic parsing isn't completely broken -- there's no error if %time estimate_pi() is moved above the function.

@XJTLUmedia
Copy link
Author

Yeah I see. It is not a big deal. But as this is kind of format suggestion to ask user put magic command on the top. It would be better to place it in warning rather than errors I think.

@judej judej added the bug Something isn't working label Aug 29, 2022
@heejaechang heejaechang self-assigned this Aug 29, 2022
@debonte
Copy link
Contributor

debonte commented Aug 29, 2022

@XJTLUmedia, sorry for the confusion, I wasn't suggesting that you change your code. This was just a note to myself for discussing the issue with the team today during our triage meeting.

@heejaechang heejaechang added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Sep 6, 2022
@debonte
Copy link
Contributor

debonte commented Sep 8, 2022

This issue has been fixed in prerelease version 2022.9.11, which we've just released. You can find the changelog here: CHANGELOG.md

@debonte debonte closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants