1
32
2
8
Generating RSS feeds in python (www.vincentlammens.be)
3
12

I'm looking to learn about this language from a technical level, and any searches I do on today's search engines is just going to return guides to writing Python code, which is not what I want.

I understand how C++ works. For example, I know that virtual functions are stored as a trap table in an object's instance, and the function is wrapped around something that decodes that trap table from this object instance.

I'm wondering if there's something that goes into that level of technicality with python. For example, I would want to know how function declarations (and re-declarations) work in python. Is the bytecode stored as a heap object which can be freed just as a regular heap object? Is it a map of strings within the current stack context? How does creating a thread handle it?

4
11
5
26
submitted 2 weeks ago* (last edited 2 weeks ago) by Custodian6718@programming.dev to c/python@programming.dev

This is a question for people more experienced with Python, but everybody feel free to answer if you feel like you can provide something decent to the discussion.

Also feel free to explain why you feel that way and your experiences with Python and the paradigms.

6
12

Example script: https://gist.github.com/thingsiplay/ae9a26322cd5830e52b036ab411afd1f

Hi all. I just wanted to share a way to handle a so called advanced help menu, where additional options are listed that are otherwise hidden with regular help. Hidden options should still function. This is just to have less clutter in normal view.

I've researched the web to see how people does it, and this is the way I like most so far. If you think this is problematic, please share your thoughts. This is for a commandline terminal application, that could also be automated through a script.

How it works on a high level

Before the ArgumentParser() is called, we check the sys.argv for the trigger option --advanced-help. Depending on this we set a variable to true or false. Then with the setup of the parser after the ArgumenParser() call, we add the --advanced-help option to the list of regular help.

advanced_help = False
for arg in sys.argv:
    if arg == "--":
        break
    if arg == "--advanced-help":
        advanced_help = True

parser = argparse.ArgumentParser()

Continue setting up your options as usual. But for the help description of those you want to exclude when using just regular -h, add an inline if else statement (ternary statement). This statement will put the help description only if advanced_help variable is true, otherwise it puts argparse.SUPPRESS to hide the option. Do this with all the options you want to hide.

parser.add_argument(
    "-c",
    "--count",
    action="store_true",
    default=False,
    help="print only a count of matching items per list, output file unaffected"
    if advanced_help
    else argparse.SUPPRESS,
)

At last we need to actually parse what you just setup. For this we need to assign our custom list, that is based on the sys.argv, plus the regular --help option. This way we can use --advanced-help without the need for -h or --help in addition to show any help message.

if advanced_help:
    args = parser.parse_args(sys.argv[0:0] + ["--help"] + sys.argv[1:])
else:
    args = parser.parse_args()

Run following program once with ./thing.py -h and ./thing.py --advanced-help.

7
5
8
4
9
4
10
9
Python 3.13.5 is now available! (pythoninsider.blogspot.com)
11
50

I ran into this at local Python meetup yesterday. Made with Python and asyncssh. Fun project and also a joke as well as commentary about current state of the social media

12
22
13
20
14
33
15
44

I'm finding myself with a couple of really big databases and my PC is throwing memory errors so I'm moving the project to polars and learning on the way in, and would like to read your experience in how you did it, what frustrate you and what you found good (I'm still getting used with the syntax, but I'm loving how fast it reads the databases)

16
28
Python 3.14.0 beta 2 is here! (pythoninsider.blogspot.com)
17
41
18
40
19
19
20
18
submitted 2 months ago by rimu@piefed.social to c/python@programming.dev

Python decorators look like a great way to add functionality—until they break your type safety, hide function requirements, and turn debugging into a nightmare. This video shows you why decorators can be dangerous, the biggest pitfalls to watch out for, and when you should actually use them.

21
16
submitted 2 months ago by cm0002@lemmy.world to c/python@programming.dev
22
16
Python 3.14.0 beta 1 is here! (pythoninsider.blogspot.com)
submitted 2 months ago by cm0002@lemmy.world to c/python@programming.dev
23
18
submitted 2 months ago by cm0002@lemmy.world to c/python@programming.dev
24
10
submitted 2 months ago by cm0002@lemmy.world to c/python@programming.dev
25
14
view more: next ›

Python

7275 readers
10 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS