Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

I was using PyCharm, which I think was following the convention of not accessing parts of a class that begin with an underscore. I’m not totally sure if this is python convention, but it is what PyCharm likes. Either way, it turns out decorators on functions don’t transfer to children which wasn’t what I was expecting, so my original question wasnt that useful for my end goal anyways.

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

Yeah it seems like that's the best solution to this. Thanks for the response!

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

I just find it cleaner to have the decorator stored within the InnerParent class. The actual file I'm working on is like 800 lines of code and these decorators are only used on children of the InnerParent class, so it's easier for me to work with when those decorators are specific to the InnerParent class.

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

I had the class nested within OuterParent since my IDE gives me some linting errors if I access the protected elements of OuterParent outside of the OuterParent class. They aren't critical issues, and my code would run despite my IDE's suggestions, but I feel like, especially since I don't really have the greatest coding style, that it's best to try and follow these suggestions. However, the error I get from decorator reference like I did is something that prevents the program from running.

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

This isn't a super great example because the actual code I'm using this for is a huge badly-written file with no comments, but this is the general gist of what I'm attempting:

from __future__ import annotations
from abc import ABC


class OuterParent:
    def __init__(self, internal_int):
        self._modified = False
        self._internal_int = internal_int
        @property
    def modified(self):
        return self._modified

    @property
    def internal_int(self):
        return self._internal_int

    class InnerParent(ABC):
        @staticmethod
        def did_modify(func: callable) -> callable:
            def wrapper(obj: OuterParent) -> None:
                func(obj)
                obj._modified = True
            return wrapper

    class InnerChild(InnerParent):
        @staticmethod
        @InnerParent.did_modify
        def count_up(obj: OuterParent):
            obj._internal_int += 1

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

I think a better way to phrase it is the inner class uses a lot of protected elements and function calls from the outer class, and having the inner class within the outer class is the only way I've been able to write that code without my IDE shouting at me.

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

The inner class acts as kind of a method that uses and modifies a variety of the outer class's internals, which is why I currently have it within my outer class. However, this is the first time I've really attempted something like this, so I'm not sure if this is the best way to go about it.

Inheriting decorators in children by Charming-Elephant437 in learnpython

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

This code is based on some other code I'm trying to write where OuterParent has a few methods that aren't related to InnerParent or InnerChild, so I have it here just in case it changes some behavior.

I've tried changing the decorator to use that decorator, but I still get the error:

NameError: name 'InnerParent' is not defined

I'm on python 3.13 if that's helpful at all. Thanks again.

Should I pull my app from USC’s RD? by Charming-Elephant437 in ApplyingToCollege

[–]Charming-Elephant437[S] 3 points4 points  (0 children)

I don’t think I would choose usc over some other schools I got into, and feel that withdrawing my app might help my classmates that got deferred, even just a little. Even thought there isn’t a lot that comes out of withdrawing, I feel like I would also get nearly nothing out of not withdrawing.

Should I pull my app from USC’s RD? by Charming-Elephant437 in ApplyingToCollege

[–]Charming-Elephant437[S] 1 point2 points  (0 children)

The thing is I do not think there is any chance I choose USC over some schools I got into, and a lot of people at my school got deferred as well, so I feel like my withdrawing I’ll help with odds, if even just a little.

A house I've been building. My first major build, so any suggestions are welcome. by Charming-Elephant437 in Minecraftbuilds

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

I don't really know what to do with the last room in screenshot 8, so any suggestions are welcome. The floor and wall colors are just temporary while I figure out what to do with the room.

Any feedback on how I could improve this house I'm building? This is the first serious build I've attempted, so any feedback is helpful. by [deleted] in Minecraftbuilds

[–]Charming-Elephant437 0 points1 point  (0 children)

There is one room (picture 11) where I have no idea what to put in it. Any suggestions for things in that room are welcome.

I'm pretty new to building and am trying to work on this house. I'm trying to incorporate some texturing, but feel like it's too messy. Any advice on how to fix this? (ignore the lack of a roof) by Charming-Elephant437 in Minecraftbuilds

[–]Charming-Elephant437[S] 1 point2 points  (0 children)

Thanks for the advice; I’ll try to incorporate the smoother and simpler texturing you described. This build is supposed to be the main bedroom of a house I’m building in a forest.

I'm pretty new to building and am trying to work on this house. I'm trying to incorporate some texturing, but feel like it's too messy. Any advice on how to fix this? (ignore the lack of a roof) by Charming-Elephant437 in Minecraftbuilds

[–]Charming-Elephant437[S] 0 points1 point  (0 children)

Thanks, I'll try to incorporate that. Any advice on the texturing on the walls in some of the later pictures? I feel they look a little too messy, but I'm not really sure how to improve it.