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

  • Home
  • SEARCH
  • 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 7861635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:48:20+00:00 2026-06-02T22:48:20+00:00

This is a simple filter that I have been using for a project reading

  • 0

This is a simple filter that I have been using for a project reading data over a serial connection, and thought it would be good to use it as my first attempt to write docstrings. Does anyone have any suggestions? I have been reading PEP 257. As it is a class, should the keyword arguments come after the __init__ ?

If there is a better way to write any part of it (not only the docstrings), I would appreciate it if people could point me in the right direction.

class Filter(object) :
    """Return x if x is greater than min and less than max - else return None. 

    Keyword arguments:
    min -- the minimum (default 0)
    max -- the maximum (default 0)

    Notes:
    Accepts integers and integer strings
    """
    def __init__(self, min=0, max=0) :
        self.min = min
        self.max = max
    def __call__(self, input) :
        try :
            if int(input) <= self.max and int(input) >= self.min : 
                return int(input)
        except : pass
  • 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-06-02T22:48:22+00:00Added an answer on June 2, 2026 at 10:48 pm

    It’s usually a good idea to use pylint and pep8 to check the code conventions and common typing mistakes.

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

Sidebar

Related Questions

I made this simple function to filter the data. I add the symbols that
I have been ripping my hair out over this issue, I want a simple
Well this is a simple question i want to filter two elements sorted reverse
Hi I have some problems that has been bothering me for a week. I
I wonder if you could help me. I have a list of data that
I have been using these common EntityObjectFilters as a pipes and filters way to
I have a project (#1) with a couple apps in it using a mysql
I've been looking into this for a while and have been unable to find
I've been stuck on this problem for a while now and have tried my
I know that a lot of c/c++ XML library questions have been asked already

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.