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

getattr in thinkplot.py Config #26

Closed
grfiv opened this issue Feb 24, 2017 · 5 comments
Closed

getattr in thinkplot.py Config #26

grfiv opened this issue Feb 24, 2017 · 5 comments

Comments

@grfiv
Copy link

grfiv commented Feb 24, 2017

I am using your notebooks with Jupyter 4.2.1 and Python 3.5.2 under Ubuntu Desktop 16.10

The code snippet

def Config(**options):
    for name in names:
        if name in options:
            getattr(pyplot, name)(options[name])

generates TypeError: 'tuple' object is not callable

The following seems to fix it for me

def Config(**options):
    for name in names:
        if name in options:
            try:
                getattr(pyplot, name)(options[name])
            except TypeError:
                setattr(pyplot, name, options[name])
@AllenDowney
Copy link
Owner

AllenDowney commented Feb 24, 2017 via email

@grfiv
Copy link
Author

grfiv commented Feb 24, 2017

http://localhost:8888/notebooks/code/chap02.ipynb

signal = thinkdsp.SquareSignal(100)
duration = signal.period*3
segment = signal.make_wave(duration, framerate=10000)
segment.plot()
thinkplot.config(ylim=[-1.05, 1.05], legend=False)

@AllenDowney
Copy link
Owner

AllenDowney commented Feb 24, 2017 via email

@grfiv
Copy link
Author

grfiv commented Feb 24, 2017

OK. Started fresh and it does not recur.

@AllenDowney
Copy link
Owner

Good news. Thanks for following up.

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

No branches or pull requests

2 participants