• why function throws an error?

    From =?UTF-8?B?16DXqteZINep15jXqNef?=@21:1/5 to All on Tue Jun 28 10:57:59 2022
    def add_route(self, route):
    # """ Add a route object, but do not change the :data:`Route.app`
    # attribute."""
    self.routes.append(route)
    self.router.add(route.rule, route.method, route, name=route.name
    )
    # if DEBUG: route.prepare()
    --
    <https://netanel.ml>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mirko@21:1/5 to All on Tue Jun 28 11:11:24 2022
    Am 28.06.22 um 09:57 schrieb נתי שטרן:
    def add_route(self, route):
    # """ Add a route object, but do not change the :data:`Route.app`
    # attribute."""
    self.routes.append(route)
    self.router.add(route.rule, route.method, route, name=route.name )
    # if DEBUG: route.prepare()
    --
    <https://netanel.ml>

    Are you still trying to combine different modules into one large
    module? That is not going to help you. First, you need to rewrite
    all those modules to seamlessly work together. This will likely be a
    huge task. Let's say you have a module that defines some function
    route():

    def route():
    print("route")

    Another module defines a variable called "route":

    route = True

    A third module needs to call the function from the first module, but
    this fails now because the second module has overwritten (shadowed)
    the former function with a variable:

    route = True
    route()

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: 'bool' object is not callable


    You would need to find all those cases where one module overwrites
    variables or functions from other modules. And sometimes those cases
    will be difficult to spot. Python is not designed for what you are
    trying to do. Even if you get this done, it will not help you. You
    can't just throw everything into a single file and then magically
    optimize it. When you have this huge final module, what do you think
    you can do with it to be faster?

    If you have performance problems with some module, you have several
    options to optimize it:

    - Find a better algorithm.
    - Rewrite performance-critical parts in Cython or even C and import
    the compiled module.
    - Use a JIT compiler such as PyPy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Tue Jun 28 09:33:13 2022
    On Tue, 28 Jun 2022 10:57:59 +0300, ??? ???? <nsh531@gmail.com> declaimed
    the following:

    def add_route(self, route):
    # """ Add a route object, but do not change the :data:`Route.app`
    # attribute."""
    self.routes.append(route)
    self.router.add(route.rule, route.method, route, name=route.name
    )
    # if DEBUG: route.prepare()

    From your subject "why function throws an error?".

    How would we know? You never show us the error traceback, you never provide a minimal code listing that someone could attempt to run to perform debugging.



    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lars Liedtke@21:1/5 to All on Tue Jun 28 10:18:42 2022
    Hey,

    Which error does it throw?
    Could you please send the stacktrace as well?

    Cheers

    Lars


    --
    Lars Liedtke
    Software Entwickler


    Phone:
    Fax: +49 721 98993-
    E-mail: lal@solute.de


    solute GmbH
    Zeppelinstraße 15
    76185 Karlsruhe
    Germany


    Marken der solute GmbH | brands of solute GmbH
    billiger.de | Shopping.de


    Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
    Webseite | www.solute.de
    Sitz | Registered Office: Karlsruhe
    Registergericht | Register Court: Amtsgericht Mannheim
    Registernummer | Register No.: HRB 110579
    USt-ID | VAT ID: DE234663798


    Informationen zum Datenschutz | Information about privacy policy http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

    Am 28.06.22 um 09:57 schrieb נתי שטרן:
    def add_route(self, route):
    # """ Add a route object, but do not change the :data:`Route.app`
    # attribute."""
    self.routes.append(route)
    self.router.add(route.rule, route.method, route, name=route.name )
    # if DEBUG: route.