Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7842 closed enhancement (fixed)

Let attrcall objects accept further arguments

Reported by: nthiery Owned by: nthiery
Priority: major Milestone: sage-4.3.1
Component: misc Keywords: attrcall
Cc: sage-combinat Merged in: sage-4.3.1.alpha2
Authors: Nicolas M. Thiéry Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

The attached patch allows for the following:

            sage: xseries = attrcall('series', x)
            sage: xseries(sin(x), 4)
            1*x + (-1/6)*x^3 + Order(x^4)

This is used in #7753

Attachments (1)

trac_7842-attrcall-nt.patch (1.4 KB) - added by nthiery 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by nthiery

comment:1 Changed 7 years ago by nthiery

  • Status changed from new to needs_review

comment:2 follow-up: Changed 7 years ago by mhansen

Another nice thing to have now that I think about it would be this syntax:

sage: xseries = attrcall.series(x)
sage: xseries(sin(x), 4)
1*x + (-1/6)*x^3 + Order(x^4)

I'll make a new ticket for this so that that it'll backward-compatible with the old version.

comment:3 in reply to: ↑ 2 Changed 7 years ago by nthiery

Replying to mhansen:

Another nice thing to have now that I think about it would be this syntax:

sage: xseries = attrcall.series(x)
sage: xseries(sin(x), 4)
1*x + (-1/6)*x^3 + Order(x^4)

Your point is that this syntax gives a better visual hint about this being about method calls, right? So here, attrcall would be some sort of dummy object placeholder? Why not. Though I am a bit reluctant with having two syntaxes.

I'll make a new ticket for this so that that it'll backward-compatible with the old version.

Do you mind reviewing this first, so that we can get #7753 in?

I'll review your patch in return :-)

comment:4 Changed 7 years ago by mhansen

  • Reviewers set to Mike Hansen
  • Status changed from needs_review to positive_review

This patch looks good to me.

We should also maybe allow putting keywords in too at the "second stage".

comment:5 Changed 7 years ago by rlm

  • Merged in set to 4.3.1.alpha2
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:6 Changed 7 years ago by mvngu

  • Merged in changed from 4.3.1.alpha2 to sage-4.3.1.alpha2
Note: See TracTickets for help on using tickets.