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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:26:54+00:00 2026-05-26T15:26:54+00:00

I have documented myself regarding the ‘key=lambda’ functionality, and have found a good reference

  • 0

I have documented myself regarding the ‘key=lambda’ functionality, and have found a good reference on its use:

http://www.daniweb.com/software-development/python/threads/376964

thanks to which I came to understand what the following code is ‘supposed’ to do:

def _min_hull_pt_pair(hulls):
    """Returns the hull, point index pair that is minimal."""
    h, p = 0, 0
    for i in xrange(len(hulls)):
        j = min(xrange(len(hulls[i])), key=lambda j: hulls[i][j])
        if hulls[i][j] < hulls[h][p]:
            h, p = i, j
    return (h, p)   

however I have a problem with the following syntax:

        j = min(xrange(len(hulls[i])), key=lambda j: hulls[i][j])

My doubts, being a python apprentice albeit learning fast:

1- do I need to trace back the calls stack-like to understand what ‘type’ or more simply ‘value’ I get retrieving hulls[i][j]? (I read that python uses the ‘duck typing’, which would explain this need, if I’m not mistaken).

2- key=lambda j basically ‘retrieves’ the [i][j] element of hulls, doesn’t it? But does this mean that hulls[i][j] is an integer type, since the ‘for’ iteration calls ‘min’ with the for’s xrange?

3- optional: is there a c# equivalent or comparable to python’s min?

Thanks in advance.

  • 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-26T15:26:55+00:00Added an answer on May 26, 2026 at 3:26 pm
    1. Yes. In particular, hulls[i][j] could be any type or any value depending on what happened at runtime. e.g. all of hulls could be integers, but you can set hulls[i][j]='foo'.

    2. Yes, the lambda there returns the jth element of the ith row in hulls. hulls[i][j] could be any comparable thing e.g. min('a','b') is 'a'

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

Sidebar

Related Questions

I have recently found myself playing around with events, and as there is no
I have a document with headings and unordered lists. How can I use JQuery
for the last hour I have been trying to figure this out myself but
I have a massive, unfamiliar Java codebase that I need to use in one
I have taught myself a lot of Objective-C over the past year and a
I have been trying everything to try and solve this myself, but cannot find
I have a small php system i created for myself. This system contains a
I have been driving myself crazy to try to do what seems so simple.
A have the document with 23 figures and 46 tables (appendix to journal article).
I have a document and want to create it as a twocolumn-document. That works

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.