Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7543603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:28:14+00:00 2026-05-30T08:28:14+00:00

I am writting a Python class with this constructor: #constuctor def __init__(self, initPt_=[1,1],fun_=Optim_tests.peaks,NITER_=30,alpha_=0.7,NMAX_=5000,FTOL_=10**(-10)): self.initPt

  • 0

I am writting a Python class with this constructor:

      #constuctor
def __init__(self, initPt_=[1,1],fun_=Optim_tests.peaks,NITER_=30,alpha_=0.7,NMAX_=5000,FTOL_=10**(-10)):
    self.initPt = initPt_
    self.fun = fun_
    self.alpha = alpha_
    self.ITER = NITER_
    self.NMAX = NMAX_
    self.FTOL = FTOL_

and defining both member functions:

def buildSimplex(self):
    self.simplex=[]
    self.simplex.append([x for x in self.initPt])
    for i in range(len(self.initPt)):
        temp=[x for x in self.initPt]
        temp[i]=self.initPt[i]+1
        self.simplex.append(temp)
    self.npts=len(self.simplex)

def sA(self):
    self.buildSimplex()

When calling second functions, error happens:

NameError: global name 'buildSimplex' is not defined    

Do you have a clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:28:15+00:00Added an answer on May 30, 2026 at 8:28 am

    At first sight I would say it’s a identation problem, but you need to provide the actual code for a more specific answer.

    The reason I’m saying this is because of the error you’re getting. If you declared your class properly, and try to call a method of an instance that is not define, you should actually get a: AttributeError: A instance has no attribute 'xxxx'. And you don’t need to care about the order you define your methods if they are declared in a class. See the e xample of met1 and met4 below

    For example:

    class A():
       def met1(self):
          print self.met4()
    
       def met2(self):
          self.met3()
    
       def met4():
          print 'x'
    
    
     a = A()
     a.met1()
     >>> x
     a.met2()
     >>> AttributeError: A instance has no attribute 'met3'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often find myself writing class constructors like this: class foo: def __init__(self, arg1,
I am writing a python function with the following: class myObj(object): def __init__(self, args):
Consider the following class: class SquareErrorDistance(object): def __init__(self, dataSample): variance = var(list(dataSample)) if variance
I am currently writing my python classes and instantiate them like this class calculations_class():
What benefit or implications could we get with Python code like this: class some_class(parent_class):
Class member functions in Python have to explicitly declare a self parameter which represents
I find myself writing this class often in my python code when I need
I am writing a Player model class in Python with Django, and I've ran
I am writing a class in Python 2.6.2 that contains a lookup table. Most
I am writting a Python script and I am running out of time. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.