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 6754187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:15:00+00:00 2026-05-26T13:15:00+00:00

I am certain I am doing this incorrectly even though it works. Right now

  • 0

I am certain I am doing this “incorrectly” even though it works. Right now when I call a function I just pass the whole object i.e.

class my_file_obj:
    def __init__(self,filename):
        self.filename = filename
        self.owner = None
        self.file_type = None
        self.fileflag = 0
        self.md5 = None

The function call, where file_obj1 is an instance of my_file_obj:

some_function(file_obj1)

and then referencing the attributes I need as needed within the function.

What is the “python”/correct way of doing this?

  • some_function(file_obj1)

  • some_function(file_obj1.filename)

  • the_filename = file_obj1.filename
    some_function(the_filename)
  • 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-26T13:15:01+00:00Added an answer on May 26, 2026 at 1:15 pm

    Well, it’s quite obvious. It depends on whether some_function needs the whole object or just the filename, in which case you pass the whole my_file_obj instance or just the filename.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to darken a UIView by a certain amount. Right now, I'm doing
I am certain I am just doing this the wrong way, but I cant
am wondering if I'm doing this right. I want to split a huge py
I don't even know if I'm doing this correctly, but I thought I'd ask
I am doing a movieplayer application and I want to activate certain settings about
Doing some jquery animation. I have certain divs set up with an attribute of
I want my program to press certain keys on my keyboard without me doing
Not certain if this will get much response due to the newness of Windows
I see Google doing this all the time. They are able to successfully create
I want to display list of items which belong to certain category like this:

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.