Code Monkey home page Code Monkey logo

Comments (3)

esc avatar esc commented on August 24, 2024

Almost correct, in fact demo2.py shouldn't print sys.argv but b. Please submit a pull-request.

from scientific-python-lectures.

muraii avatar muraii commented on August 24, 2024

I see that you're pulling in demo2.py with .. literalinclude:: demo2.py, and demo2.py correctly defines print_b():

# print_b() runs on import
print_b()

The demo2.py in the rendered guide does not match the demo2.py of the repo:

import sys

def print_a():
    "Prints a."
    print 'a'

print sys.argv

if __name__ == '__main__':
    print_a()

vs.

def print_b():
    "Prints b."
    print 'b'

def print_a():
    "Prints a."
    print 'a'

# print_b() runs on import
print_b()

if __name__ == '__main__':
    # print_a() is only executed when the module is run directly.
    print_a()

There's nothing to correct in the fork. Maybe GitHub just needs to rerender the guide?

from scientific-python-lectures.

esc avatar esc commented on August 24, 2024

Thanks for investigating, looks like it is time for a new release afterall.

from scientific-python-lectures.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.