Skip to content

Fix indentation in example in docs#2786

Merged
jessica-mitchell merged 3 commits intonest:masterfrom
clinssen:conn_mgmt_doc_clean
Jun 22, 2023
Merged

Fix indentation in example in docs#2786
jessica-mitchell merged 3 commits intonest:masterfrom
clinssen:conn_mgmt_doc_clean

Conversation

@clinssen
Copy link
Contributor

Also fix np -> numpy and numpy.int64 -> int.

The examples in the docs mix code and code output, for example, in that same file:

::

    print(nest.GetDefaults('static_synapse'))

        {'delay': 1.0,
         'has_delay': True,
         'num_connections': 0,
         'receptor_type': 0,
         'requires_symmetric': False,
         'sizeof': 32,
         'synapse_model': 'static_synapse',
         'weight': 1.0,
         'weight_recorder': ()}

    nest.SetDefaults('static_synapse', {'weight': 2.5})

What's the best way to split these up? Different blocks demarcated by ::?

@clinssen clinssen added T: Bug Wrong statements in the code or documentation ZC: Documentation DO NOT USE THIS LABEL labels May 13, 2023
@clinssen clinssen requested a review from jessica-mitchell May 13, 2023 13:29
@jessica-mitchell jessica-mitchell added S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) and removed ZC: Documentation DO NOT USE THIS LABEL labels May 24, 2023
@jessica-mitchell
Copy link
Contributor

jessica-mitchell commented May 24, 2023

@clinssen For code that has input / output , the >>> syntax should be used
I would suggest given that example something like

>>>    print(nest.GetDefaults('static_synapse')) 
          {'delay': 1.0,
           'has_delay': True,
           'num_connections': 0,
           'receptor_type': 0,
           'requires_symmetric': False,
           'sizeof': 32,
           'synapse_model': 'static_synapse',
           'weight': 1.0,
           'weight_recorder': ()}
::

    nest.SetDefaults('static_synapse', {'weight': 2.5})

This will separate the blocks of course, but I think it makes the output consistent with other blocks that use that syntax.

@clinssen
Copy link
Contributor Author

Guideline for the use of ">>>" in Python code examples: restrict to single-line (or very-few-line) snippets of code. Code that prepares for the line containing ">>>", for instance by instantiating neurons and connections, will go without ">>>".

Copy link
Contributor

@jessica-mitchell jessica-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clinssen this looks good to me, I'm gonna follow up with a PR so that the copy button des not copy the prompt symbol

@jessica-mitchell
Copy link
Contributor

merging this with one reviewer as its doc related

@jessica-mitchell jessica-mitchell merged commit 2bde63d into nest:master Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Bug Wrong statements in the code or documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Comments