diff --git a/bot/resources/tags/args-kwargs.md b/bot/resources/tags/args-kwargs.md index b440a23464..67d93fc40f 100644 --- a/bot/resources/tags/args-kwargs.md +++ b/bot/resources/tags/args-kwargs.md @@ -1,5 +1,7 @@ -`*args` and `**kwargs` - +--- +embed: + title: "The `*args` and `**kwargs` parameters" +--- These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names `args` and `kwargs` are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (`*`). If both are used in a function signature, `*args` **must** appear before `**kwargs`. **Single asterisk** @@ -9,9 +11,9 @@ These special parameters allow functions to take arbitrary amounts of positional `**kwargs` will ingest an arbitrary amount of **keyword arguments**, and store it in a dictionary. There can be **no** additional parameters **after** `**kwargs` in the parameter list. **Use cases** -• **Decorators** (see `!tags decorators`) +• **Decorators** (see `/tag decorators`) • **Inheritance** (overriding methods) • **Future proofing** (in the case of the first two bullet points, if the parameters change, your code won't break) • **Flexibility** (writing functions that behave like `dict()` or `print()`) -*See* `!tags positional-keyword` *for information about positional and keyword arguments* +*See* `/tag positional-keyword` *for information about positional and keyword arguments* diff --git a/bot/resources/tags/async-await.md b/bot/resources/tags/async-await.md index 01ab28fe3b..a3d8bde84b 100644 --- a/bot/resources/tags/async-await.md +++ b/bot/resources/tags/async-await.md @@ -1,5 +1,7 @@ -**Concurrency in Python** - +--- +embed: + title: "Concurrency in Python" +--- Python provides the ability to run multiple tasks and coroutines simultaneously with the use of the `asyncio` library, which is included in the Python standard library. This works by running these coroutines in an event loop, where the context of the running coroutine switches periodically to allow all other coroutines to run, thus giving the appearance of running at the same time. This is different to using threads or processes in that all code runs in the main process and thread, although it is possible to run coroutines in other threads. diff --git a/bot/resources/tags/blocking.md b/bot/resources/tags/blocking.md index 5554d7eba5..1999e2421f 100644 --- a/bot/resources/tags/blocking.md +++ b/bot/resources/tags/blocking.md @@ -1,4 +1,7 @@ -**Why do we need asynchronous programming?** +--- +embed: + title: "Asynchronous programming" +--- Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do **not** use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming. **What is asynchronous programming?** diff --git a/bot/resources/tags/botvar.md b/bot/resources/tags/botvar.md index 3db6ae7acb..e4ea8b87d6 100644 --- a/bot/resources/tags/botvar.md +++ b/bot/resources/tags/botvar.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Bot variables" +--- Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below: ```py diff --git a/bot/resources/tags/class.md b/bot/resources/tags/class.md index 4f73fc974a..5fbe43c181 100644 --- a/bot/resources/tags/class.md +++ b/bot/resources/tags/class.md @@ -1,5 +1,7 @@ -**Classes** - +--- +embed: + title: "Classes" +--- Classes are used to create objects that have specific behavior. Every object in python has a class, including `list`s, `dict`ionaries and even numbers. Using a class to group code and data like this is the foundation of Object Oriented Programming. Classes allow you to expose a simple, consistent interface while hiding the more complicated details. This simplifies the rest of your program and makes it easier to separately maintain and debug each component. diff --git a/bot/resources/tags/classmethod.md b/bot/resources/tags/classmethod.md index a4e803093a..2452de8e82 100644 --- a/bot/resources/tags/classmethod.md +++ b/bot/resources/tags/classmethod.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The `@classmethod` decorator" +--- Although most methods are tied to an _object instance_, it can sometimes be useful to create a method that does something with _the class itself_. To achieve this in Python, you can use the `@classmethod` decorator. This is often used to provide alternative constructors for a class. For example, you may be writing a class that takes some magic token (like an API key) as a constructor argument, but you sometimes read this token from a configuration file. You could make use of a `@classmethod` to create an alternate constructor for when you want to read from the configuration file. diff --git a/bot/resources/tags/codeblock.md b/bot/resources/tags/codeblock.md index 6cb90696a0..c2b77637e5 100644 --- a/bot/resources/tags/codeblock.md +++ b/bot/resources/tags/codeblock.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Formatting code on discord" +--- Here's how to format Python code on Discord: \`\`\`py diff --git a/bot/resources/tags/comparison.md b/bot/resources/tags/comparison.md index 12844bd2f5..5db17cc284 100644 --- a/bot/resources/tags/comparison.md +++ b/bot/resources/tags/comparison.md @@ -1,5 +1,7 @@ -**Assignment vs. Comparison** - +--- +embed: + title: "Assignment vs comparison`" +--- The assignment operator (`=`) is used to assign variables. ```python x = 5 diff --git a/bot/resources/tags/contribute.md b/bot/resources/tags/contribute.md index 50c5cd11fe..57eae0a7eb 100644 --- a/bot/resources/tags/contribute.md +++ b/bot/resources/tags/contribute.md @@ -1,4 +1,7 @@ -**Contribute to Python Discord's Open Source Projects** +--- +embed: + title: "Contribute to Python Discord's open source projects" +--- Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before! **Projects to Contribute to** diff --git a/bot/resources/tags/customchecks.md b/bot/resources/tags/customchecks.md index 23ff7a66ff..46e4c8f3ef 100644 --- a/bot/resources/tags/customchecks.md +++ b/bot/resources/tags/customchecks.md @@ -1,5 +1,7 @@ -**Custom Command Checks in discord.py** - +--- +embed: + title: "Custom command checks in discord.py" +--- Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides `discord.ext.commands.check` which allows you to create you own checks like this: ```py from discord.ext.commands import check, Context diff --git a/bot/resources/tags/customcooldown.md b/bot/resources/tags/customcooldown.md index 65935952b5..78d1d253e2 100644 --- a/bot/resources/tags/customcooldown.md +++ b/bot/resources/tags/customcooldown.md @@ -1,5 +1,7 @@ -**Cooldowns in discord.py** - +--- +embed: + title: "Cooldowns in discord.py" +--- Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message. ```python diff --git a/bot/resources/tags/customhelp.md b/bot/resources/tags/customhelp.md index 6f0b17642e..5dc1a05411 100644 --- a/bot/resources/tags/customhelp.md +++ b/bot/resources/tags/customhelp.md @@ -1,3 +1,5 @@ -**Custom help commands in discord.py** - +--- +embed: + title: "Custom help commands in discord.py" +--- To learn more about how to create custom help commands in discord.py by subclassing the help command, please see [this tutorial](https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96#embed-minimalhelpcommand) by Stella#2000 diff --git a/bot/resources/tags/decorators.md b/bot/resources/tags/decorators.md index 39c943f0ac..65d221d6e7 100644 --- a/bot/resources/tags/decorators.md +++ b/bot/resources/tags/decorators.md @@ -1,5 +1,7 @@ -**Decorators** - +--- +embed: + title: "Decorators" +--- A decorator is a function that modifies another function. Consider the following example of a timer decorator: diff --git a/bot/resources/tags/defaultdict.md b/bot/resources/tags/defaultdict.md index b6c3175fc9..82555b7a1a 100644 --- a/bot/resources/tags/defaultdict.md +++ b/bot/resources/tags/defaultdict.md @@ -1,5 +1,7 @@ -**[`collections.defaultdict`](https://docs.python.org/3/library/collections.html#collections.defaultdict)** - +--- +embed: + title: "The `collections.defaultdict` class" +--- The Python `defaultdict` type behaves almost exactly like a regular Python dictionary, but if you try to access or modify a missing key, the `defaultdict` will automatically insert the key and generate a default value for it. While instantiating a `defaultdict`, we pass in a function that tells it how to create a default value for missing keys. @@ -19,3 +21,4 @@ In this example, we've used the `int` class which returns 0 when called like a f >>> my_dict defaultdict(, {'foo': 0, 'bar': 5}) ``` +Check out the [`docs`](https://docs.python.org/3/library/collections.html#collections.defaultdict) to learn even more! diff --git a/bot/resources/tags/dict-get.md b/bot/resources/tags/dict-get.md index e02df03abe..57d5349e1a 100644 --- a/bot/resources/tags/dict-get.md +++ b/bot/resources/tags/dict-get.md @@ -1,7 +1,9 @@ +--- +embed: + title: "The `dict.get` method" +--- Often while using dictionaries in Python, you may run into `KeyErrors`. This error is raised when you try to access a key that isn't present in your dictionary. Python gives you some neat ways to handle them. -**The `dict.get` method** - The [`dict.get`](https://docs.python.org/3/library/stdtypes.html#dict.get) method will return the value for the key if it exists, and None (or a default value that you specify) if the key doesn't exist. Hence it will _never raise_ a KeyError. ```py >>> my_dict = {"foo": 1, "bar": 2} diff --git a/bot/resources/tags/dictcomps.md b/bot/resources/tags/dictcomps.md index 75fbe0f8a9..75f0f7b3a7 100644 --- a/bot/resources/tags/dictcomps.md +++ b/bot/resources/tags/dictcomps.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Dictionary comprehensions" +--- Dictionary comprehensions (*dict comps*) provide a convenient way to make dictionaries, just like list comps: ```py >>> {word.lower(): len(word) for word in ('I', 'love', 'Python')} diff --git a/bot/resources/tags/docstring.md b/bot/resources/tags/docstring.md index 6e9d9aa093..ee07ff5f7b 100644 --- a/bot/resources/tags/docstring.md +++ b/bot/resources/tags/docstring.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Docstrings" +--- A [`docstring`](https://docs.python.org/3/glossary.html#term-docstring) is a string - always using triple quotes - that's placed at the top of files, classes and functions. A docstring should contain a clear explanation of what it's describing. You can also include descriptions of the subject's parameter(s) and what it returns, as shown below: ```py def greet(name: str, age: int) -> str: diff --git a/bot/resources/tags/dotenv.md b/bot/resources/tags/dotenv.md index acb9a216eb..14fff3458a 100644 --- a/bot/resources/tags/dotenv.md +++ b/bot/resources/tags/dotenv.md @@ -1,5 +1,7 @@ -**Using .env files in Python** - +--- +embed: + title: "Using .env files in Python" +--- `.env` (dotenv) files are a type of file commonly used for storing application secrets and variables, for example API tokens and URLs, although they may also be used for storing other configurable values. While they are commonly used for storing secrets, at a high level their purpose is to load environment variables into a program. Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a `.gitignore` file. diff --git a/bot/resources/tags/dunder-methods.md b/bot/resources/tags/dunder-methods.md index be2b97b7b7..e3f7538025 100644 --- a/bot/resources/tags/dunder-methods.md +++ b/bot/resources/tags/dunder-methods.md @@ -1,5 +1,7 @@ -**Dunder methods** - +--- +embed: + title: "Dunder methods" +--- Double-underscore methods, or "dunder" methods, are special methods defined in a class that are invoked implicitly. Like the name suggests, they are prefixed and suffixed with dunders. You've probably already seen some, such as the `__init__` dunder method, also known as the "constructor" of a class, which is implicitly invoked when you instantiate an instance of a class. When you create a new class, there will be default dunder methods inherited from the `object` class. However, we can override them by redefining these methods within the new class. For example, the default `__init__` method from `object` doesn't take any arguments, so we almost always override that to fit our needs. diff --git a/bot/resources/tags/empty-json.md b/bot/resources/tags/empty-json.md index 935544bb7f..8892976716 100644 --- a/bot/resources/tags/empty-json.md +++ b/bot/resources/tags/empty-json.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Empty JSON error" +--- When using JSON, you might run into the following error: ``` JSONDecodeError: Expecting value: line 1 column 1 (char 0) diff --git a/bot/resources/tags/enumerate.md b/bot/resources/tags/enumerate.md index da9c86a366..c84ad323af 100644 --- a/bot/resources/tags/enumerate.md +++ b/bot/resources/tags/enumerate.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The `enumerate` function" +--- Ever find yourself in need of the current iteration number of your `for` loop? You should use **enumerate**! Using `enumerate`, you can turn code that looks like this: ```py index = 0 diff --git a/bot/resources/tags/environments.md b/bot/resources/tags/environments.md index 7402bbec4e..d6ed06448d 100644 --- a/bot/resources/tags/environments.md +++ b/bot/resources/tags/environments.md @@ -1,9 +1,8 @@ --- aliases: ["envs"] embed: - title: "Python Environments" + title: "Python environments" --- - The main purpose of Python [virtual environments](https://docs.Python.org/3/library/venv.html#venv-def) is to create an isolated environment for Python projects. This means that each project can have its own dependencies, such as third party packages installed using pip, regardless of what dependencies every other project has. To see the current environment in use by Python, you can run: diff --git a/bot/resources/tags/except.md b/bot/resources/tags/except.md index 8f0abf156e..934efdd768 100644 --- a/bot/resources/tags/except.md +++ b/bot/resources/tags/except.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Error handling" +--- A key part of the Python philosophy is to ask for forgiveness, not permission. This means that it's okay to write code that may produce an error, as long as you specify how that error should be handled. Code written this way is readable and resilient. ```py try: diff --git a/bot/resources/tags/exit().md b/bot/resources/tags/exit().md index 27da9f8667..57cfaaaaba 100644 --- a/bot/resources/tags/exit().md +++ b/bot/resources/tags/exit().md @@ -1,5 +1,7 @@ -**Exiting Programmatically** - +--- +embed: + title: "Exiting programmatically" +--- If you want to exit your code programmatically, you might think to use the functions `exit()` or `quit()`, however this is bad practice. These functions are constants added by the [`site`](https://docs.python.org/3/library/site.html#module-site) module as a convenient method for exiting the interactive interpreter shell, and should not be used in programs. You should use either [`SystemExit`](https://docs.python.org/3/library/exceptions.html#SystemExit) or [`sys.exit()`](https://docs.python.org/3/library/sys.html#sys.exit) instead. diff --git a/bot/resources/tags/f-strings.md b/bot/resources/tags/f-strings.md index ab6ec75c98..92d7c62e2c 100644 --- a/bot/resources/tags/f-strings.md +++ b/bot/resources/tags/f-strings.md @@ -1,5 +1,7 @@ --- aliases: ["fstrings", "fstring", "f-string"] +embed: + title: "Format-strings" --- Creating a Python string with your variables using the `+` operator can be difficult to write and read. F-strings (*format-strings*) make it easy to insert values into a string. If you put an `f` in front of the first quote, you can then put Python expressions between curly braces in the string. diff --git a/bot/resources/tags/faq.md b/bot/resources/tags/faq.md index e1c57b3a0e..6299240fcd 100644 --- a/bot/resources/tags/faq.md +++ b/bot/resources/tags/faq.md @@ -2,5 +2,4 @@ embed: title: "Frequently asked questions" --- - As the largest Python community on Discord, we get hundreds of questions every day. Many of these questions have been asked before. We've compiled a list of the most frequently asked questions along with their answers, which can be found on our [FAQ page](https://www.pythondiscord.com/pages/frequently-asked-questions/). diff --git a/bot/resources/tags/floats.md b/bot/resources/tags/floats.md index 03fcd72683..d9d5373772 100644 --- a/bot/resources/tags/floats.md +++ b/bot/resources/tags/floats.md @@ -1,4 +1,7 @@ -**Floating Point Arithmetic** +--- +embed: + title: "Floating point arithmetic" +--- You may have noticed that when doing arithmetic with floats in Python you sometimes get strange results, like this: ```python >>> 0.1 + 0.2 diff --git a/bot/resources/tags/foo.md b/bot/resources/tags/foo.md index 98529bfc03..0a40eb991c 100644 --- a/bot/resources/tags/foo.md +++ b/bot/resources/tags/foo.md @@ -1,5 +1,7 @@ -**Metasyntactic variables** - +--- +embed: + title: "Metasyntactic variables" +--- A specific word or set of words identified as a placeholder used in programming. They are used to name entities such as variables, functions, etc, whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming. Common examples include `foobar`, `foo`, `bar`, `baz`, and `qux`. diff --git a/bot/resources/tags/for-else.md b/bot/resources/tags/for-else.md index e102e4e752..a6e79add08 100644 --- a/bot/resources/tags/for-else.md +++ b/bot/resources/tags/for-else.md @@ -1,5 +1,7 @@ -**for-else** - +--- +embed: + title: "The for-else block" +--- In Python it's possible to attach an `else` clause to a for loop. The code under the `else` block will be run when the iterable is exhausted (there are no more items to iterate over). Code within the else block will **not** run if the loop is broken out using `break`. Here's an example of its usage: diff --git a/bot/resources/tags/functions-are-objects.md b/bot/resources/tags/functions-are-objects.md index 01af7a7211..88f3ddeb44 100644 --- a/bot/resources/tags/functions-are-objects.md +++ b/bot/resources/tags/functions-are-objects.md @@ -1,5 +1,7 @@ -**Calling vs. Referencing functions** - +--- +embed: + title: "Calling vs. referencing functions" +--- When assigning a new name to a function, storing it in a container, or passing it as an argument, a common mistake made is to call the function. Instead of getting the actual function, you'll get its return value. In Python you can treat function names just like any other variable. Assume there was a function called `now` that returns the current time. If you did `x = now()`, the current time would be assigned to `x`, but if you did `x = now`, the function `now` itself would be assigned to `x`. `x` and `now` would both equally reference the function. diff --git a/bot/resources/tags/global.md b/bot/resources/tags/global.md index 64c316b627..c463121ab7 100644 --- a/bot/resources/tags/global.md +++ b/bot/resources/tags/global.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Globals" +--- When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values. Instead of writing diff --git a/bot/resources/tags/guilds.md b/bot/resources/tags/guilds.md index 571abb99b9..565b01cefe 100644 --- a/bot/resources/tags/guilds.md +++ b/bot/resources/tags/guilds.md @@ -1,3 +1,5 @@ -**Communities** - +--- +embed: + title: "Communities" +--- The [communities page](https://pythondiscord.com/pages/resources/communities/) on our website contains a number of communities we have partnered with as well as a [curated list](https://github.com/mhxion/awesome-discord-communities) of other communities relating to programming and technology. diff --git a/bot/resources/tags/identity.md b/bot/resources/tags/identity.md index f9fb0925cd..aa8974a292 100644 --- a/bot/resources/tags/identity.md +++ b/bot/resources/tags/identity.md @@ -1,5 +1,7 @@ -**Identity vs. Equality** - +--- +embed: + title: "Identity vs. equality" +--- Should I be using `is` or `==`? To check if two objects are equal, use the equality operator (`==`). diff --git a/bot/resources/tags/if-name-main.md b/bot/resources/tags/if-name-main.md index 9d88bb897f..c2a7eb289a 100644 --- a/bot/resources/tags/if-name-main.md +++ b/bot/resources/tags/if-name-main.md @@ -1,5 +1,7 @@ -`if __name__ == '__main__'` - +--- +embed: + title: "`if __name__ == '__main__'`" +--- This is a statement that is only true if the module (your source code) it appears in is being run directly, as opposed to being imported into another module. When you run your module, the `__name__` special variable is automatically set to the string `'__main__'`. Conversely, when you import that same module into a different one, and run that, `__name__` is instead set to the filename of your module minus the `.py` extension. **Example** diff --git a/bot/resources/tags/indent.md b/bot/resources/tags/indent.md index 4c3cdd126b..96ef53310a 100644 --- a/bot/resources/tags/indent.md +++ b/bot/resources/tags/indent.md @@ -1,5 +1,7 @@ -**Indentation** - +--- +embed: + title: "Indentation" +--- Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements. Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines. diff --git a/bot/resources/tags/inline.md b/bot/resources/tags/inline.md index 1c02807270..f502434601 100644 --- a/bot/resources/tags/inline.md +++ b/bot/resources/tags/inline.md @@ -1,5 +1,7 @@ -**Inline codeblocks** - +--- +embed: + title: "Inline codeblocks" +--- Inline codeblocks look `like this`. To create them you surround text with single backticks, so \`hello\` would become `hello`. Note that backticks are not quotes, see [this](https://superuser.com/questions/254076/how-do-i-type-the-tick-and-backtick-characters-on-windows/254077#254077) if you are struggling to find the backtick key. diff --git a/bot/resources/tags/intents.md b/bot/resources/tags/intents.md index 9e3ed560b9..9cb17b0d97 100644 --- a/bot/resources/tags/intents.md +++ b/bot/resources/tags/intents.md @@ -1,5 +1,7 @@ -**Using intents in discord.py** - +--- +embed: + title: "Using intents in discord.py" +--- Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed [in its documentation](https://discordpy.readthedocs.io/en/stable/api.html#intents). Since discord.py v2.0.0, it has become **mandatory** for developers to explicitly define the values of these intents in their code. There are *standard* and *privileged* intents. To use privileged intents like `Presences`, `Server Members`, and `Message Content`, you have to first enable them in the [Discord Developer Portal](https://discord.com/developers/applications). In there, go to the `Bot` page of your application, scroll down to the `Privileged Gateway Intents` section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal. diff --git a/bot/resources/tags/iterate-dict.md b/bot/resources/tags/iterate-dict.md index 78c067b204..40477444f3 100644 --- a/bot/resources/tags/iterate-dict.md +++ b/bot/resources/tags/iterate-dict.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Iteration over dictionaries" +--- There are two common ways to iterate over a dictionary in Python. To iterate over the keys: ```py for key in my_dict: diff --git a/bot/resources/tags/kindling-projects.md b/bot/resources/tags/kindling-projects.md index 54ed8c961a..00ab95513c 100644 --- a/bot/resources/tags/kindling-projects.md +++ b/bot/resources/tags/kindling-projects.md @@ -1,3 +1,5 @@ -**Kindling Projects** - +--- +embed: + title: "Kindling Projects" +--- The [Kindling projects page](https://nedbatchelder.com/text/kindling.html) on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge. diff --git a/bot/resources/tags/listcomps.md b/bot/resources/tags/listcomps.md index ccede4fbaa..1b51883eec 100644 --- a/bot/resources/tags/listcomps.md +++ b/bot/resources/tags/listcomps.md @@ -1,3 +1,7 @@ +--- +embed: + title: "List comprehensions" +--- Do you ever find yourself writing something like this? ```py >>> squares = [] diff --git a/bot/resources/tags/local-file.md b/bot/resources/tags/local-file.md index da4ac21ce0..40e0a2380b 100644 --- a/bot/resources/tags/local-file.md +++ b/bot/resources/tags/local-file.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Sending images in embeds using discord.py" +--- Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of [`discord.File`](https://discordpy.readthedocs.io/en/stable/api.html#discord.File) class: ```py # When you know the file exact path, you can pass it. diff --git a/bot/resources/tags/microsoft-build-tools.md b/bot/resources/tags/microsoft-build-tools.md index 7c702e2965..367a1e0f8e 100644 --- a/bot/resources/tags/microsoft-build-tools.md +++ b/bot/resources/tags/microsoft-build-tools.md @@ -1,5 +1,7 @@ -**Microsoft Visual C++ Build Tools** - +--- +embed: + title: "Microsoft Visual C++ Build Tools" +--- When you install a library through `pip` on Windows, sometimes you may encounter this error: ``` diff --git a/bot/resources/tags/modmail.md b/bot/resources/tags/modmail.md index 8ac19c8a74..15a7404e1f 100644 --- a/bot/resources/tags/modmail.md +++ b/bot/resources/tags/modmail.md @@ -1,5 +1,7 @@ -**Contacting the moderation team via ModMail** - +--- +embed: + title: "Contacting the moderation team via ModMail" +--- <@!683001325440860340> is a bot that will relay your messages to our moderation team, so that you can start a conversation with the moderation team. Your messages will be relayed to the entire moderator team, who will be able to respond to you via the bot. It supports attachments, codeblocks, and reactions. As communication happens over direct messages, the conversation will stay between you and the mod team. diff --git a/bot/resources/tags/mutability.md b/bot/resources/tags/mutability.md index bde9b5e7ef..a1d2c8ee04 100644 --- a/bot/resources/tags/mutability.md +++ b/bot/resources/tags/mutability.md @@ -1,5 +1,7 @@ -**Mutable vs immutable objects** - +--- +embed: + title: "Mutable vs immutable objects" +--- Imagine that you want to make all letters in a string upper case. Conveniently, strings have an `.upper()` method. You might think that this would work: diff --git a/bot/resources/tags/mutable-default-args.md b/bot/resources/tags/mutable-default-args.md index a8f0c38b35..e314e6c432 100644 --- a/bot/resources/tags/mutable-default-args.md +++ b/bot/resources/tags/mutable-default-args.md @@ -1,5 +1,7 @@ -**Mutable Default Arguments** - +--- +embed: + title: "Mutable default arguments" +--- Default arguments in python are evaluated *once* when the function is **defined**, *not* each time the function is **called**. This means that if you have a mutable default argument and mutate it, you will have diff --git a/bot/resources/tags/names.md b/bot/resources/tags/names.md index 3e76269f7d..f949c861a6 100644 --- a/bot/resources/tags/names.md +++ b/bot/resources/tags/names.md @@ -1,5 +1,7 @@ -**Naming and Binding** - +--- +embed: + title: "Naming and binding" +--- A name is a piece of text that is bound to an object. They are a **reference** to an object. Examples are function names, class names, module names, variables, etc. **Note:** Names **cannot** reference other names, and assignment **never** creates a copy. diff --git a/bot/resources/tags/nomodule.md b/bot/resources/tags/nomodule.md index adae555bec..2f420e4bc8 100644 --- a/bot/resources/tags/nomodule.md +++ b/bot/resources/tags/nomodule.md @@ -1,8 +1,10 @@ -**ModuleNotFoundError** - +--- +embed: + title: "The `ModuleNotFoundError` error" +--- If you've installed a package but you're getting a ModuleNotFoundError when you try to import it, it's likely that the environment where your code is running is different from the one where you did the installation. -You can read about Python environments at `!tags environments` and `!tags venv`. +You can read about Python environments at `/tag environments` and `/tag venv`. Common causes of this problem include: diff --git a/bot/resources/tags/off-topic-names.md b/bot/resources/tags/off-topic-names.md index 5d0614aaa0..44a16d0c23 100644 --- a/bot/resources/tags/off-topic-names.md +++ b/bot/resources/tags/off-topic-names.md @@ -1,5 +1,7 @@ -**Off-topic channels** - +--- +embed: + title: "Off-topic channels" +--- There are three off-topic channels: • <#291284109232308226> • <#463035241142026251> diff --git a/bot/resources/tags/open.md b/bot/resources/tags/open.md index 13b4555b95..3947cb88dd 100644 --- a/bot/resources/tags/open.md +++ b/bot/resources/tags/open.md @@ -1,5 +1,7 @@ -**Opening files** - +--- +embed: + title: "Opening files" +--- The built-in function `open()` is one of several ways to open files on your computer. It accepts many different parameters, so this tag will only go over two of them (`file` and `mode`). For more extensive documentation on all these parameters, consult the [official documentation](https://docs.python.org/3/library/functions.html#open). The object returned from this function is a [file object or stream](https://docs.python.org/3/glossary.html#term-file-object), for which the full documentation can be found [here](https://docs.python.org/3/library/io.html#io.TextIOBase). See also: diff --git a/bot/resources/tags/or-gotcha.md b/bot/resources/tags/or-gotcha.md index 25ade8620d..88944f3a8a 100644 --- a/bot/resources/tags/or-gotcha.md +++ b/bot/resources/tags/or-gotcha.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The or-gotcha" +--- When checking if something is equal to one thing or another, you might think that this is possible: ```py # Incorrect... diff --git a/bot/resources/tags/ot.md b/bot/resources/tags/ot.md index 636e591108..46d33d615a 100644 --- a/bot/resources/tags/ot.md +++ b/bot/resources/tags/ot.md @@ -1,3 +1,7 @@ -**Off-topic channel:** <#463035268514185226> +--- +embed: + title: "Off-topic channel" +--- +<#463035268514185226> Please read our [off-topic etiquette](https://pythondiscord.com/pages/resources/guides/off-topic-etiquette/) before participating in conversations. diff --git a/bot/resources/tags/param-arg.md b/bot/resources/tags/param-arg.md index 88069d8bd1..852114921f 100644 --- a/bot/resources/tags/param-arg.md +++ b/bot/resources/tags/param-arg.md @@ -1,5 +1,7 @@ -**Parameters vs. Arguments** - +--- +embed: + title: "Parameters vs. arguments" +--- A parameter is a variable defined in a function signature (the line with `def` in it), while arguments are objects passed to a function call. ```py diff --git a/bot/resources/tags/paste.md b/bot/resources/tags/paste.md index d2d54d48ef..f4c004291a 100644 --- a/bot/resources/tags/paste.md +++ b/bot/resources/tags/paste.md @@ -1,5 +1,7 @@ -**Pasting large amounts of code** - +--- +embed: + title: "Pasting large amounts of code" +--- If your code is too long to fit in a codeblock in Discord, you can paste your code here: https://paste.pythondiscord.com/ diff --git a/bot/resources/tags/pathlib.md b/bot/resources/tags/pathlib.md index 24ca895d88..db6c1f3eb8 100644 --- a/bot/resources/tags/pathlib.md +++ b/bot/resources/tags/pathlib.md @@ -1,5 +1,7 @@ -**Pathlib** - +--- +embed: + title: "The `pathlib` module" +--- Python 3 comes with a new module named `Pathlib`. Since Python 3.6, `pathlib.Path` objects work nearly everywhere that `os.path` can be used, meaning you can integrate your new code directly into legacy code without having to rewrite anything. Pathlib makes working with paths way simpler than `os.path` does. **Feature spotlight**: @@ -18,4 +20,4 @@ Python 3 comes with a new module named `Pathlib`. Since Python 3.6, `pathlib.Pat • [**Why you should use pathlib** - Trey Hunner](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/) • [**Answering concerns about pathlib** - Trey Hunner](https://treyhunner.com/2019/01/no-really-pathlib-is-great/) • [**Official Documentation**](https://docs.python.org/3/library/pathlib.html) -• [**PEP 519** - Adding a file system path protocol](https://peps.python.org/pep-0519/) +• [**PEP 519** - Adding a file system path protocol](https://peps.python.org/pep-0519/) diff --git a/bot/resources/tags/pep8.md b/bot/resources/tags/pep8.md index a2510d6970..98c739e5ed 100644 --- a/bot/resources/tags/pep8.md +++ b/bot/resources/tags/pep8.md @@ -1,3 +1,7 @@ +--- +embed: + title: "PEP 8" +--- **PEP 8** is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide. More information: diff --git a/bot/resources/tags/positional-keyword.md b/bot/resources/tags/positional-keyword.md index d6b4e0cd4b..8b4cf56112 100644 --- a/bot/resources/tags/positional-keyword.md +++ b/bot/resources/tags/positional-keyword.md @@ -1,5 +1,7 @@ -**Positional vs. Keyword arguments** - +--- +embed: + title: "Positional vs. keyword arguments" +--- Functions can take two different kinds of arguments. A positional argument is just the object itself. A keyword argument is a name assigned to an object. **Example** @@ -35,4 +37,4 @@ The reverse is also true: **More info** • [Keyword only arguments](https://peps.python.org/pep-3102/) • [Positional only arguments](https://peps.python.org/pep-0570/) -• `!tags param-arg` (Parameters vs. Arguments) +• `/tag param-arg` (Parameters vs. Arguments) diff --git a/bot/resources/tags/precedence.md b/bot/resources/tags/precedence.md index ed399143ca..a9b3c40705 100644 --- a/bot/resources/tags/precedence.md +++ b/bot/resources/tags/precedence.md @@ -1,5 +1,7 @@ -**Operator Precedence** - +--- +embed: + title: "Operator precedence" +--- Operator precedence is essentially like an order of operations for python's operators. **Example 1** (arithmetic) diff --git a/bot/resources/tags/quotes.md b/bot/resources/tags/quotes.md index 99ce93f61a..cea6d0147f 100644 --- a/bot/resources/tags/quotes.md +++ b/bot/resources/tags/quotes.md @@ -1,5 +1,7 @@ -**String Quotes** - +--- +embed: + title: "String quotes" +--- Single and Double quoted strings are the **same** in Python. The choice of which one to use is up to you, just make sure that you **stick to that choice**. With that said, there are exceptions to this that are more important than consistency. If a single or double quote is needed *inside* the string, using the opposite quotation is better than using escape characters. diff --git a/bot/resources/tags/range-len.md b/bot/resources/tags/range-len.md index 65665eccf4..4bd377d590 100644 --- a/bot/resources/tags/range-len.md +++ b/bot/resources/tags/range-len.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Pythonic way of iterating over ordered collections" +--- Iterating over `range(len(...))` is a common approach to accessing each item in an ordered collection. ```py for i in range(len(my_list)): diff --git a/bot/resources/tags/regex.md b/bot/resources/tags/regex.md index ae7960b378..d8bbb38cd0 100644 --- a/bot/resources/tags/regex.md +++ b/bot/resources/tags/regex.md @@ -1,4 +1,7 @@ -**Regular expressions** +--- +embed: + title: "Regular expressions" +--- Regular expressions (regex) are a tool for finding patterns in strings. The standard library's `re` module defines functions for using regex patterns. **Example** diff --git a/bot/resources/tags/relative-path.md b/bot/resources/tags/relative-path.md index 6e97b78af6..c9feb2e523 100644 --- a/bot/resources/tags/relative-path.md +++ b/bot/resources/tags/relative-path.md @@ -1,5 +1,7 @@ -**Relative Path** - +--- +embed: + title: "Relative path" +--- A relative path is a partial path that is relative to your current working directory. A common misconception is that your current working directory is the location of the module you're executing, **but this is not the case**. Your current working directory is actually the **directory you were in when you ran the python interpreter**. The reason for this misconception is because a common way to run your code is to navigate to the directory your module is stored, and run `python .py`. Thus, in this case your current working directory will be the same as the location of the module. However, if we instead did `python path/to/.py`, our current working directory would no longer be the same as the location of the module we're executing. **Why is this important?** diff --git a/bot/resources/tags/repl.md b/bot/resources/tags/repl.md index 875b4ec47b..7d56457d3f 100644 --- a/bot/resources/tags/repl.md +++ b/bot/resources/tags/repl.md @@ -1,5 +1,7 @@ -**Read-Eval-Print Loop** - +--- +embed: + title: "Read-Eval-Print Loop (REPL)" +--- A REPL is an interactive language shell environment. It first **reads** one or more expressions entered by the user, **evaluates** it, yields the result, and **prints** it out to the user. It will then **loop** back to the **read** step. To use python's REPL, execute the interpreter with no arguments. This will drop you into the interactive interpreter shell, print out some relevant information, and then prompt you with the primary prompt `>>>`. At this point it is waiting for your input. diff --git a/bot/resources/tags/return-gif.md b/bot/resources/tags/return-gif.md index 1229151fe7..57b6afefbe 100644 --- a/bot/resources/tags/return-gif.md +++ b/bot/resources/tags/return-gif.md @@ -1,10 +1,10 @@ --- aliases: ["print-return", "return-jif"] embed: - title: Print and Return + title: Print and return image: url: https://raw.githubusercontent.com/python-discord/bot/main/bot/resources/media/print-return.gif --- Here's a handy animation demonstrating how `print` and `return` differ in behavior. -See also: `!tags return` +See also: `/tag return` diff --git a/bot/resources/tags/return.md b/bot/resources/tags/return.md index 1d65ab1ae0..805a17ee19 100644 --- a/bot/resources/tags/return.md +++ b/bot/resources/tags/return.md @@ -1,5 +1,7 @@ -**Return Statement** - +--- +embed: + title: "Return statement" +--- A value created inside a function can't be used outside of it unless you `return` it. Consider the following function: @@ -29,4 +31,4 @@ None **Things to note** • `print()` and `return` do **not** accomplish the same thing. `print()` will show the value, and then it will be gone. • A function will return `None` if it ends without a `return` statement. -• When you want to print a value from a function, it's best to return the value and print the *function call* instead, like `print(square(5))`. +• When you want to print a value from a function, it's best to return the value and print the *function call* instead, like `print(square(5))`. diff --git a/bot/resources/tags/round.md b/bot/resources/tags/round.md index 0392bb41b2..fc67ca2f97 100644 --- a/bot/resources/tags/round.md +++ b/bot/resources/tags/round.md @@ -1,5 +1,7 @@ -**Round half to even** - +--- +embed: + title: "Round half to even*" +--- Python 3 uses bankers' rounding (also known by other names), where if the fractional part of a number is `.5`, it's rounded to the nearest **even** result instead of away from zero. Example: @@ -21,4 +23,4 @@ It should be noted that round half to even distorts the distribution by increasi • [Wikipedia article about rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even) • [Documentation on `round` function](https://docs.python.org/3/library/functions.html#round) • [`round` in what's new in python 3](https://docs.python.org/3/whatsnew/3.0.html#builtins) (4th bullet down) -• [How to force rounding technique](https://stackoverflow.com/a/10826537/4607272) +• [How to force rounding technique](https://stackoverflow.com/a/10826537/4607272) diff --git a/bot/resources/tags/scope.md b/bot/resources/tags/scope.md index 5c1e64e1c8..cd55acf8cd 100644 --- a/bot/resources/tags/scope.md +++ b/bot/resources/tags/scope.md @@ -1,8 +1,10 @@ -**Scoping Rules** - +--- +embed: + title: "Scoping rules" +--- A *scope* defines the visibility of a name within a block, where a block is a piece of python code executed as a unit. For simplicity, this would be a module, a function body, and a class definition. A name refers to text bound to an object. -*For more information about names, see `!tags names`* +*For more information about names, see `/tag names`* A module is the source code file itself, and encompasses all blocks defined within it. Therefore if a variable is defined at the module level (top-level code block), it is a global variable and can be accessed anywhere in the module as long as the block in which it's referenced is executed after it was defined. diff --git a/bot/resources/tags/seek.md b/bot/resources/tags/seek.md index bc013fe036..53949506e8 100644 --- a/bot/resources/tags/seek.md +++ b/bot/resources/tags/seek.md @@ -1,5 +1,7 @@ -**Seek** - +--- +embed: + title: "Seek" +--- In the context of a [file object](https://docs.python.org/3/glossary.html#term-file-object), the `seek` function changes the stream position to a given byte offset, with an optional argument of where to offset from. While you can find the official documentation [here](https://docs.python.org/3/library/io.html#io.IOBase.seek), it can be unclear how to actually use this feature, so keep reading to see examples on how to use it. File named `example`: diff --git a/bot/resources/tags/self.md b/bot/resources/tags/self.md index d20154fd5d..a90e0ffc58 100644 --- a/bot/resources/tags/self.md +++ b/bot/resources/tags/self.md @@ -1,5 +1,7 @@ -**Class instance** - +--- +embed: + title: "Class instance" +--- When calling a method from a class instance (ie. `instance.method()`), the instance itself will automatically be passed as the first argument implicitly. By convention, we call this `self`, but it could technically be called any valid variable name. ```py diff --git a/bot/resources/tags/site.md b/bot/resources/tags/site.md index 376f847420..d5ffc5e1fb 100644 --- a/bot/resources/tags/site.md +++ b/bot/resources/tags/site.md @@ -1,6 +1,5 @@ --- embed: - title: "Python Discord Website" + title: "Python Discord website" --- - [Our official website](https://www.pythondiscord.com/) is an open-source community project created with Python and Django. It contains information about the server itself, lets you sign up for upcoming events, has its own wiki, contains a list of valuable learning resources, and much more. diff --git a/bot/resources/tags/sql-fstring.md b/bot/resources/tags/sql-fstring.md index fa28b6e3b1..b57d6cb3af 100644 --- a/bot/resources/tags/sql-fstring.md +++ b/bot/resources/tags/sql-fstring.md @@ -1,4 +1,7 @@ -**SQL & f-strings** +--- +embed: + title: "SQL & f-strings" +--- Don't use f-strings (`f""`) or other forms of "string interpolation" (`%`, `+`, `.format`) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection. Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, **safely**. diff --git a/bot/resources/tags/star-imports.md b/bot/resources/tags/star-imports.md index 6e20e2b09e..43e29fea57 100644 --- a/bot/resources/tags/star-imports.md +++ b/bot/resources/tags/star-imports.md @@ -1,4 +1,7 @@ -**Star / Wildcard imports** +--- +embed: + title: "Star / Wildcard imports" +--- Wildcard imports are import statements in the form `from import *`. What imports like these do is that they import everything **[1]** from the module into the current module's namespace **[2]**. This allows you to use names defined in the imported module without prefixing the module's name. diff --git a/bot/resources/tags/str-join.md b/bot/resources/tags/str-join.md index c835f9313b..67fe583216 100644 --- a/bot/resources/tags/str-join.md +++ b/bot/resources/tags/str-join.md @@ -1,5 +1,7 @@ -**Joining Iterables** - +--- +embed: + title: "Joining iterables" +--- If you want to display a list (or some other iterable), you can write: ```py colors = ['red', 'green', 'blue', 'yellow'] diff --git a/bot/resources/tags/string-formatting.md b/bot/resources/tags/string-formatting.md index 707d19c901..281107e4a7 100644 --- a/bot/resources/tags/string-formatting.md +++ b/bot/resources/tags/string-formatting.md @@ -1,4 +1,7 @@ -**String Formatting Mini-Language** +--- +embed: + title: "String formatting mini-language" +--- The String Formatting Language in Python is a powerful way to tailor the display of strings and other data structures. This string formatting mini language works for f-strings and `.format()`. Take a look at some of these examples! diff --git a/bot/resources/tags/strip-gotcha.md b/bot/resources/tags/strip-gotcha.md index 9ad495cd2c..934b10f1a3 100644 --- a/bot/resources/tags/strip-gotcha.md +++ b/bot/resources/tags/strip-gotcha.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The strip-gotcha" +--- When working with `strip`, `lstrip`, or `rstrip`, you might think that this would be the case: ```py >>> "Monty Python".rstrip(" Python") diff --git a/bot/resources/tags/traceback.md b/bot/resources/tags/traceback.md index e05d8b2597..005f23b1c1 100644 --- a/bot/resources/tags/traceback.md +++ b/bot/resources/tags/traceback.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Traceback" +--- Please provide the full traceback for your exception in order to help us identify your issue. While the last line of the error message tells us what kind of error you got, the full traceback will tell us which line, and other critical information to solve your problem. diff --git a/bot/resources/tags/type-hint.md b/bot/resources/tags/type-hint.md index f4a12f1251..315257349b 100644 --- a/bot/resources/tags/type-hint.md +++ b/bot/resources/tags/type-hint.md @@ -1,5 +1,7 @@ -**Type Hints** - +--- +embed: + title: "Type hints" +--- A type hint indicates what type a variable is expected to be. ```python def add(a: int, b: int) -> int: diff --git a/bot/resources/tags/underscore.md b/bot/resources/tags/underscore.md index 4da2e86ca0..06c525538d 100644 --- a/bot/resources/tags/underscore.md +++ b/bot/resources/tags/underscore.md @@ -1,7 +1,7 @@ --- aliases: ["under"] embed: - title: "Meanings of Underscores in Identifier Names" + title: "Meanings of underscores in identifier names" --- • `__name__`: Used to implement special behaviour, such as the `+` operator for classes with the `__add__` method. [More info](https://dbader.org/blog/python-dunder-methods) diff --git a/bot/resources/tags/venv.md b/bot/resources/tags/venv.md index 99ff2a7077..bf0158fdeb 100644 --- a/bot/resources/tags/venv.md +++ b/bot/resources/tags/venv.md @@ -1,7 +1,7 @@ --- aliases: ["virtualenv"] embed: - title: "Virtual Environments" + title: "Virtual environments" --- Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements. diff --git a/bot/resources/tags/voice-verification.md b/bot/resources/tags/voice-verification.md index 3d88b0c71f..5ec3ec2b39 100644 --- a/bot/resources/tags/voice-verification.md +++ b/bot/resources/tags/voice-verification.md @@ -1,3 +1,5 @@ -**Voice verification** - +--- +embed: + title: "Voice verification" +--- Can’t talk in voice chat? Check out <#764802555427029012> to get access. The criteria for verifying are specified there. diff --git a/bot/resources/tags/windows-path.md b/bot/resources/tags/windows-path.md index b2b0da029f..af28c3eb08 100644 --- a/bot/resources/tags/windows-path.md +++ b/bot/resources/tags/windows-path.md @@ -1,5 +1,7 @@ -**PATH on Windows** - +--- +embed: + title: "PATH on Windows" +--- If you have installed Python but forgot to check the `Add Python to PATH` option during the installation, you may still be able to access your installation with ease. If you did not uncheck the option to install the `py launcher`, then you'll instead have a `py` command which can be used in the same way. If you want to be able to access your Python installation via the `python` command, then your best option is to re-install Python (remembering to tick the `Add Python to PATH` checkbox). diff --git a/bot/resources/tags/with.md b/bot/resources/tags/with.md index 83f160b4f0..b429165123 100644 --- a/bot/resources/tags/with.md +++ b/bot/resources/tags/with.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The `with` keyword" +--- The `with` keyword triggers a context manager. Context managers automatically set up and take down data connections, or any other kind of object that implements the magic methods `__enter__` and `__exit__`. ```py with open("test.txt", "r") as file: diff --git a/bot/resources/tags/xy-problem.md b/bot/resources/tags/xy-problem.md index 8c508f18cc..f831eaf1d3 100644 --- a/bot/resources/tags/xy-problem.md +++ b/bot/resources/tags/xy-problem.md @@ -1,7 +1,9 @@ -**xy-problem** - +--- +embed: + title: "xy-problem" +--- The XY problem can be summarised as asking about your attempted solution, rather than your actual problem. Often programmers will get distracted with a potential solution they've come up with, and will try asking for help getting it to work. However, it's possible this solution either wouldn't work as they expect, or there's a much better solution instead. -For more information and examples, see http://xyproblem.info/ +For more information and examples, see http://xyproblem.info/. diff --git a/bot/resources/tags/ytdl.md b/bot/resources/tags/ytdl.md index 68a0a0cdbb..611b2c48c8 100644 --- a/bot/resources/tags/ytdl.md +++ b/bot/resources/tags/ytdl.md @@ -1,3 +1,7 @@ +--- +embed: + title: "Our youtube-dl, or equivalents, policy" +--- Per [Python Discord's Rule 5](https://pythondiscord.com/pages/rules), we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service. For reference, this usage is covered by the following clauses in [YouTube's TOS](https://www.youtube.com/static?gl=GB&template=terms), as of 2021-03-17: diff --git a/bot/resources/tags/zip.md b/bot/resources/tags/zip.md index 6f3157f715..6d82456945 100644 --- a/bot/resources/tags/zip.md +++ b/bot/resources/tags/zip.md @@ -1,3 +1,7 @@ +--- +embed: + title: "The `zip` function" +--- The zip function allows you to iterate through multiple iterables simultaneously. It joins the iterables together, almost like a zipper, so that each new element is a tuple with one element from each iterable. ```py