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

Compress the README a bit #223

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,13 @@ Tagref works with any programming language, and it respects your `.gitignore` fi

Tagref allows you to annotate your code with *tags* (in comments) which can be *referenced* from other parts of the codebase.

Here's an example in Python. The `polynomial` function below returns a nonzero number:

```python
def polynomial(x):
return x ** 2 + 1
```

Suppose you want to use that function somewhere (possibly in a different file), and your code relies on the fact that it never returns zero:

```python
def inverse_polynomial(x):
return 1 / polynomial(x)
```

It's natural to feel a bit uncomfortable with that. If someone changes the definition of `polynomial`, your code might raise a `ZeroDivisionError`! So you add a tag where `polynomial` is defined:
Here's an example in Python:

```python
# [tag:polynomial_nonzero] This function never returns zero.
def polynomial(x):
return x ** 2 + 1
```

Now you can reference the tag in your code:

```python
def inverse_polynomial(x):
return 1 / polynomial(x) # This is safe due to [ref:polynomial_nonzero].
```
Expand Down
Loading