{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cc422f6f-0f76-44e3-a249-e00c416c5608",
   "metadata": {},
   "source": [
    "# Notes on Python Coding Style (under construction)\n",
    "\n",
    "## Restrictions on characters used in names\n",
    "\n",
    "TL;DR: *Mostly letters and digits*.\n",
    "\n",
    "- The names of **Python variables** (including the names of functions) must start with a letter and only contain *letters*, *digits*, and the *underscore* `_` (typed as \"shift-dash\").\n",
    "That is, no **dashes** (`-`), **spaces** or other punctuation.\n",
    " \n",
    "- The names of **files containing Python modules** must follow the above restrictions\n",
    "(apart from the period in the suffix \".py\" of course)\n",
    "because these names are used as variable names in `import` statements.\n",
    "\n",
    "- The names of **notebook files** have just a little more flexibility: they can also include *hyphens*.\n",
    "That is, they should only contain letters, digits, underscores and hyphens; no **spaces** or other punctuation.\n",
    "(Again, apart from the period in the suffix \".ipynb\".)\n",
    "<br>\n",
    "<em>Aside:</em> this is roughly the same rule as for web-site addresses.\n",
    "<br>\n",
    "Although you can get away with some other characters in some situations, that will run into problems in situations like cross-referencing to a notebook from another notebook, posting on a web-site, and using a notebook as a section in a Jupyter Book."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd6ec01d-691e-4e98-ad0b-806ddeb46bbf",
   "metadata": {},
   "source": [
    "## Naming style\n",
    "\n",
    "In this book names are sometimes a description formed from several words,\n",
    "and since spaces are forbidden, this is generally done by using *camelCase*;\n",
    "for example, an error estimate might be in a variable `errorEstimate`.\n",
    "(Another popular style is to use the underscore as a proxy for a space, as with `error_estimate`.)\n",
    "\n",
    "One place where underscores are used in names is where the corresponding mathematical notation would have a subscript;\n",
    "for example, the mathematical name $x_0$ becomes `x_0`. (This mimics the LaTeX notation for subscripts.)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
