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

Explain += in Creating Functions - Issue#529 #544

Open
wants to merge 2 commits into
base: gh-pages
from

Conversation

Projects
None yet
3 participants
@mzc9

mzc9 commented Jun 1, 2018

No description provided.

@annefou

This comment has been minimized.

Collaborator

annefou commented Jun 12, 2018

Thanks @mzc9 for your contribution. We should probably refer to in-place operators as done in lesson 05 (http://swcarpentry.github.io/python-novice-inflammation/05-cond/index.html) with a link to http://swcarpentry.github.io/python-novice-inflammation/reference/#in-place-operators
Thanks.

mzc9
@maxim-belkin

This comment has been minimized.

Collaborator

maxim-belkin commented Jun 12, 2018

+= is first used in episode 04 (composite_data += data). So, let's make sure we introduce += in the right place.

Also, please estimate the amount of time it would require an instructor to go through the introduced material.

@maxim-belkin

Please see my comments. Once they're addressed, we can discuss where to move this material (episode 01?)

@@ -685,6 +685,25 @@ programmer. If you need to revisit code that you wrote months ago and
haven't thought about since then, you will appreciate the value of
readable code!

Python (and most other languages in the C family) provides

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 12, 2018

Collaborator

Remove (and most other languages in the C family)

> {: .output}

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 12, 2018

Collaborator

Remove 1 empty line

@@ -685,6 +685,25 @@ programmer. If you need to revisit code that you wrote months ago and
haven't thought about since then, you will appreciate the value of
readable code!

Python (and most other languages in the C family) provides
[in-place operators]({{ page.root }}/reference/#in-place-operators)
that work like this:

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 12, 2018

Collaborator

replace work like this: with an explanation.
Note, the one given on the reference page is not ideal either. Explain what += does in simple terms.

>
> ~~~
> x = 1 # original value
> x += 1 # add one to x, assigning result back to x

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 12, 2018

Collaborator

x += 1 # increment x by 1

@maxim-belkin maxim-belkin force-pushed the swcarpentry:gh-pages branch from 4753644 to 90848ea Oct 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment