Skip to content

do not mutate num_of_cores  #7

Description

@aishpant

Refer to comment in commit "use system cpu count to run spatch" .

Mutating variables outside the scope of a function is in general a bad idea.

  • You cannot move this function elsewhere now, because its tied up to the environment
  • You cannot unit test this function without mocking a global object
  • You have another function (or parts of code) that is implicitly depending on this function being called before, but that is not very clear when you read the code.
  • Mutation in general makes code harder to understand

Reported by: @jaseemabid.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions