avatarYancy Dennis

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1886

Abstract

he way, it’s going to be the norm in the working world anyway? Excuse me for being a woefully ignorant (and unemployed) teenager but I’m pretty sure we haven’t taken AI <i>that far </i>yet, have we? Otherwise, we might as well just embrace WALL-E right now.</p><p id="4649">Excuse me while I pick my jaw up off the floor.</p><div id="4ad9" class="link-block"> <a href="https://readmedium.com/on-being-an-american-high-schooler-in-the-age-of-chatgpt-2d27fe41d045"> <div> <div> <h2>On Being an American High Schooler in the Age of ChatGPT</h2> <div><h3>A Student’s Perspective on the Rise of ChatGPT</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*3twDLepwsuNErETEGq_sYA.jpeg)"></div> </div> </div> </a> </div><p id="479e">For context, teachers have been drilling into our heads for the past year that if they even <i>suspect</i> that AI did your homework you would receive a big fat zero. Harsh? Maybe. But we’re talking about education here, not some sci-fi experiment gone wild. And speaking of the “world of work,” I’m pretty sure most Medium publications have a similar no-tolerance stance towards AI.</p><p id="b7ee">When AI first become mainstream, I was falsely accused of using AI to complete homework assignments simply because I “write too good.” I know others who have had similar situations happen to them. Especially older teachers and professors are more likely to arbitrarily declare something AI-generated simply because it’s well-written. I even taught my English teacher how to use an AI detector and interpret the percentages it gives you. Meanwhile, I’m pretty sure there are plenty of people who are actuall

Options

y using AI to cheat, making a strict no-tolerance stance justified. (If this is you, go ask ChatGPT to generate some morals for you).</p><p id="7757">The irony is not lost on me. It’s becoming a peculiar world where students teach their teachers the nuances of technology, bridging the widening generational gap in understanding.</p><p id="5822" type="7">As someone with potentially seven or eight more years of secondary and post-secondary education ahead of him, I quite literally have absolutely no idea what that will look like. It’s daunting.</p><p id="c23a">I’m all for progress and preparing students for the future (I’m literally one of them), but this feels like we’re skipping a few crucial steps here. What about critical thinking? Creativity? Learning how to actually research and write? Are we just going to let AI do all the heavy lifting while we sit back and watch? Call me an old-fashioned 16 year old and tell me <i>you </i>wouldn’t be unsettled by living in a world where several of your classmate’s English papers were written by some algorithm <i>and </i>they receive an A for it.</p><p id="6d70">Just… no. Alas, that’s our world.</p><p id="d29e">I do want to be clear — I’m not anti-AI. AI has huge potential for literally all the reasons every other <a href="https://medium.com/tag/ai">article on AI</a> mentions. But how AI is upending our education system is being completely underreported in our current narrative and collective discourse. Everyone keeps saying that we are living in a momentous time; standing on the precipice of something revolutionary and new.</p><p id="b30e">How are we supposed to navigate it?</p><p id="f936"><i>I would love to read your thoughts in the comments, so drop one below! By the way, I’m not abandoning Medium — I promise! :) School is just super busy. See you around and thanks for reading! ~ Aiden ❤️</i></p></article></body>

Introduction to Python Typing: The Importance of Type Hints in Python

How to Improve Code Readability, Maintainability, and Reliability with the Python Typing Package

The Python Typing package is a module that was added to Python 3.5 to provide support for type hints. In recent years, type hints have become a popular feature in Python, as they help make code more readable, maintainable, and less prone to bugs. In this article, we'll explore the benefits of using type hints, and how to get started with the Typing module in your own Python projects.

Photo by Sangga Rima Roman Selia on Unsplash

Why use type hints?

Type hints are optional annotations that you can add to your code to specify the expected type of a function's inputs and outputs. This information can be used by other tools to catch type-related errors before they happen, and to provide better documentation for others who are reading your code.

One of the main benefits of using type hints is that they make your code more self-documenting. When a function is well-documented with type hints, it becomes much easier for others (and even for yourself, in a few months or years) to understand what the function is meant to do, and what inputs and outputs it can handle.

Another benefit of type hints is that they help catch type-related errors before they happen. When you use a type hint in a function, you are essentially saying "this argument should be of this type." If someone tries to pass an argument of a different type, a type checker can raise an error before the code is executed. This can help you catch bugs early, before they cause more serious problems.

Finally, type hints can also help improve performance. Some tools, like the mypy static type checker, can use type hints to optimize code and avoid costly type checks at runtime.

Getting started with the Typing module

The Typing module provides a number of types that you can use as type hints in your code. For example, to specify that a function takes an integer as an argument, you can use the int type:

from typing import int

def square(n: int) -> int:
    return n ** 2

Here, we've used the int type to specify that the n argument should be an integer. We've also used the -> int syntax to specify that the function should return an integer.

You can also use more complex types, such as lists and dictionaries. For example:

from typing import List, Dict

def count_words(words: List[str]) -> Dict[str, int]:
    word_counts = {}
    for word in words:
        if word in word_counts:
            word_counts[word] += 1
        else:
            word_counts[word] = 1
    return word_counts

Here, we've used the List and Dict types to specify that the words argument should be a list of strings, and that the function should return a dictionary mapping strings to integers.

Another useful type provided by the Typing module is the Union type. The Union type allows you to specify that a value can be of one of several types. For example:

from typing import Union

def divide(a: int, b: int) -> Union[int, float]:
    return a / b

Here, we've used the Union type to specify that the result of the divide function can either be an integer or a float.

Conclusion

The Typing module is a powerful tool that can help you write more readable, maintainable, and bug-free Python code. By using type hints, you can specify the expected types of function inputs and outputs, making your code easier to understand and maintain. Type hints also help catch type-related errors before they happen, and can improve performance by allowing tools like mypy to optimize code.

In this article, I've seen how to get started with the Typing module, and how to use it to specify the types of function inputs and outputs. Whether you're working on a small personal project or a large-scale enterprise application, incorporating type hints into your Python code is a great way to improve the quality and reliability of your code.

There's much more to learn about type hints and the Typing module, so be sure to explore the official Python documentation to learn more. With a little bit of effort, you'll find that type hints are a valuable tool that can help you write better Python code.

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

Build awareness and adoption for your tech startup with Circuit.

Technology
Python
Programming
Coding
Artificial Intelligence
Recommended from ReadMedium