Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Can the scope of a module be expanded ?
I have a module named which has a class optimizer. The class contains 2 static member functions. looks something like this:
class optimizer:
    def gradientDescentOptimizer(input,mappings,net:nn.nn,alpha=0.001,lamb=None, epoch=100,print_at=5,prnt=True):

    def SGDOptimizer(input,mappings,net:nn.nn,mini_batch_size=64,alpha=0.001,lamb=None, epoch=5,print_at=5,prnt=True):

To access the functions in other modules, I need to follow this syntax:
import optimizer

x = optimizer.optimizer.functionName(arguments)
I was wondering if there is a way to expand the scope of the optimizer class so that the function can be accessed by referring to the optimizer class just once, like this :
import optimizer

x = optimizer.functionName(arguments)
from optimizer import optimizer

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Block of code, scope of variables and surprising exception arbiel 8 454 Apr-06-2020, 07:57 PM
Last Post: arbiel
  Help with Global/Coerced Variable (Understanding Scope) Rev2k 6 366 Jan-09-2020, 03:43 AM
Last Post: Rev2k
  Solving a scope issue profconn1 4 475 Nov-01-2019, 07:46 PM
Last Post: profconn1
  Namespace and scope difference Uchikago 9 905 Jul-03-2019, 03:36 PM
Last Post: Uchikago
  what is scope for python? samexpert 2 445 Jun-24-2019, 01:03 PM
Last Post: metulburr
  main function scope issues wak_stephanie 1 842 Aug-29-2018, 02:53 AM
Last Post: Larz60+
  Help in understanding scope of dictionaries and lists passed to recursive functions barles 2 986 Aug-11-2018, 06:45 PM
Last Post: barles
  Variable Scope for Scripts QueenSvetlana 6 1,516 Dec-01-2017, 08:54 PM
Last Post: snippsat
  Problem With Scope Of A Variable Saif133 5 2,531 Jan-05-2017, 05:18 PM
Last Post: snippsat
  List out of scope? kjorin 13 4,967 Nov-08-2016, 04:25 AM
Last Post: kjorin

Forum Jump:

Users browsing this thread: 1 Guest(s)