urequests and r.close()



  • The text book says

    n=1; m=n 
    

    doesn't create a new object for m it just references the same object that n is referencing.

    When I do

    r=urequests.get('https://someurl'); val=r.text; r.close(); return val
    

    why does val still retain it's value when r.close() destroys the urequests return object? I came up with the above because

    r=urequests.get('https://someurl'); r.close(); return r.text 
    

    caused OSErrors from urequests. But now I'm wondering why it works?


Log in to reply
 

Pycom on Twitter