« first day (3991 days earlier)      last day (964 days later) » 

1:15 AM
@BlueeSkyy perhaps. What's your problem.
That was supposed to have a question mark. Strange, seeing as I invented the thing...
 
Hi!
Anybody on? Guess not :)
 
2:21 AM
@VintageMind Sup Dog
 
 
2 hours later…
4:20 AM
cabbage
 
4:52 AM
cbg guys
 
cbg!
 
 
3 hours later…
8:03 AM
cbg
 
 
10 hours later…
5:59 PM
Guess there's no hope of a record cabbage sequence on this quiet Sunday, so ...
TIL my computer is quite happy to run a virtual environment from Google Drive, mounted into my filestore at /Volumes/GoogleDrive/. Not sure what it would do to my Google bandwidth charges, but it's interestingly responsive even for stuff like Jupyter notebooks.
(.venv3.10) sholden@fathead-2 Notebooks % which python
/Volumes/GoogleDrive/.shortcut-targets-by-id/1hjdoqZyLe5ZozuiimlKFz3oNQ_T4sK_D/Python in a Nutshell 4ed/Notebooks/.venv3.10/bin/python
(.venv3.10) sholden@fathead-2 Notebooks % time python --version
Python 3.10.0a6
python --version  0.00s user 0.00s system 36% cpu 0.021 total
I suspect the Drive client does some pretty fancy cacheing.
I see the star board's got another update.
 
6:32 PM
Hey all, can someone help me understand this short answer? stackoverflow.com/a/45210833/4974485 (Question is: block scopes in python)
I dont understand the purpose of defining a nested function then immediaetly calling it..why not just call it when you want to use the nested function?
 
it's a poor man's substitute of explicit scopes as one would find in other languages.
they aren't interested in having a function, they only care about having a separate scope.
defining a function and immediately calling it is "as if" one just had an explicit scope.
 
Ahhhhh I see, so the sole reason of the function is to create a separate scope
 
indeed. 🧐
 
thank you
 
 
3 hours later…
9:45 PM
I have another dumb question, is there any reason why a function call my_func() will return None, but a generator function call my_gen() returns an instantiated generator object
I dont think I have a specific targeted question, more on listening to your thoughts. The syntax for generators and regular functions are similar yet do differnet things (unintutive at first sight mabye?), like calling a generator seems to be constructing a generator object that we can iterate over, but calling a function does none of that
 
That's the whole point of the yield statement, making it easy to create generators. A function with a yield inside returns a generator, that's just how it works
 
10:39 PM
I wonder if anyone has ever implemented a generator without using the yield statement
 
11:08 PM
pretty sure its possible with generator expressions right?
x = 3
      def func():
          print(x)
          x = 4
      func()
Two questions on this, (i) why does it give an error, and (ii) why doesnt it print "3" before it errors out
I know that the first print statmeent, its reading the globla variable x, and that assignment statement x=4 causes x in the function to be a local variable. But the assingment statement came after the print one, so it shouldnt have a problem printing "3" followed by "4"? Im wondering why is this considered an error at all?
x = 3
def func():
    print(x)
    x = 4
    print(x)
func()
ignore the wrong indentation in the first message
 
11:27 PM
@AstralWolf names are assigned a scope during compilation. If a name is bound to anywhere, it is deemed local.
Try doing x += 1: error. Try putting x = 4 after a return: error. Try putting a yield after a return: the function becomes a generator function.
These assessments are all static and are shown in dis.dis
(Confidence in the above statements: 90%)
 

« first day (3991 days earlier)      last day (964 days later) »