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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:22:48+00:00 2026-06-01T17:22:48+00:00

I am pretty bad at stating my problem clearly. Sorry. Basically, I have many

  • 0

I am pretty bad at stating my problem clearly. Sorry.

Basically, I have many view functions whose functionalities are very similar. Part of it is using reverse. However, each of those view functions execute different reverse, so I cannot write them one by one in my new “generic view”. That’s insane.

At the time, I am trying to reduce the amount of duplicated codes I am writing (that’s over 500 lines of duplication!!!!!)

To solve this problem, I have a few helper functions, one of which is to evaluate reverse on whatever view function is given and whatever args are passed to the helper function.

def render_reverse(f, args):
    return eval(...)

But eval is evil, and is slow. Any substitute for eval? A better approach to solve this in Django?

Thanks.

  • 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-01T17:22:50+00:00Added an answer on June 1, 2026 at 5:22 pm

    Why do you need to eval at all in the first place? Just call reverse() normally?

    return reverse(f, *args)
    

    The * lets you unpack the argument list into actual args.


    That said, why do you need this helper at all? Why not just put return reverse(... in your view?

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

Sidebar

Related Questions

I have the following problem and I'm pretty bad at CSS, but good at
Sorry because I'm pretty bad in PHP Thus I find myself very very stupidly
First of all sorry for my bad english and Im pretty new in these
I am having a pretty bad night with this one. I have been running
CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('…')
Ant seems to be pretty bad as running interactive program. So for instance, a
This post reference to the One Definition Rule. Wikipedia is pretty bad on explaining
Pretty much what the title says really. We have some code that is .NET
Pretty simple scenario. I have a web service that receives a byte array that
Pretty simple question: When i have a persistable object, it usually has a property

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.