René's URL Explorer Experiment


Title: Implement named arguments and With semantics in C# embedding side by dsuarezv · Pull Request #461 · pythonnet/pythonnet · GitHub

Open Graph Title: Implement named arguments and With semantics in C# embedding side by dsuarezv · Pull Request #461 · pythonnet/pythonnet

X Title: Implement named arguments and With semantics in C# embedding side by dsuarezv · Pull Request #461 · pythonnet/pythonnet

Description: Named Arguments I have implemented support for calling methods using named arguments on the C# side. Say we have this code in Python: yes = numpy.ones(9, dtype = numpy.int) logger = k.callbacks.CSVLogger('log.csv', separator = ',', append = False) Here is how this translated to C# with the old syntax (using keyword arguments in Py): dynamic yes = numpy.ones(9, Py.pw("dtype", numpy.@int)); dynamic logger = k.callbacks.CSVLogger("log.csv", Py.kw("separator", ",", "append", false)); With the new named argument support: dynamic yes = numpy.ones(9, dtype: numpy.@int); dynamic logger = k.callbacks.CSVLogger("log.csv", separator:",", append: false); I think the new syntax has better readability. With semantics Also implemented the semantics of the Python with statement in the embedded side. Take this pice of python code: with tf.device('/cpu:0') as dev: model = GetSequenceModel() model.fit(X, Y, epochs = 150, batch_size = 32) This was tricky to replicate before in embedded C#. Now it can be called like this: Py.With((PyObject)tf.device("/cpu:0"), dev => { dynamic model = GetSequenceModel(); model.fit(X, Y, epochs: 150, batch_size: 32); }); I implemented the semantics of calling enter and exit in context managers as described in the python docs. Tests Some new NUnit tests have been created and added to the embeddingTest project for both named arguments and the new With method. Hope you find it useful for the project.

Open Graph Description: Named Arguments I have implemented support for calling methods using named arguments on the C# side. Say we have this code in Python: yes = numpy.ones(9, dtype = numpy.int) logger = k.callbacks.CSV...

X Description: Named Arguments I have implemented support for calling methods using named arguments on the C# side. Say we have this code in Python: yes = numpy.ones(9, dtype = numpy.int) logger = k.callbacks.CSV...

Opengraph URL: https://github.com/pythonnet/pythonnet/pull/461

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1f740ba0-5c6e-694d-6fc2-aee807d20b8c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE288:3C5761:2AF41A7:3C693B5:69710440
html-safe-noncecbc4a6ce3e74349a9cda22a0690405ffb6156cea59b0df46a6f5ad04615eb361
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjg4OjNDNTc2MToyQUY0MUE3OjNDNjkzQjU6Njk3MTA0NDAiLCJ2aXNpdG9yX2lkIjoiMTgxNDA5Nzg5NDQzMjYzODAxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac22a5952446912a78be8a8b63c1ee415da750aec0886d980a2137ab9418913527
hovercard-subject-tagpull_request:119816840
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/461/files
twitter:imagehttps://avatars.githubusercontent.com/u/220631?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/220631?s=400&v=4
og:image:altNamed Arguments I have implemented support for calling methods using named arguments on the C# side. Say we have this code in Python: yes = numpy.ones(9, dtype = numpy.int) logger = k.callbacks.CSV...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2d17fd2bbd784dc91f3a78a2f1d2c41d9f4f8ce86136d09833e3cf21b2bde1b7
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee053d923fb27a9d948f8cefae8ba3bf43f7b938f
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pythonnet/pythonnet/pull/461/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F461%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F461%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://github.com/pythonnet/pythonnet/pull/461/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/461/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/461/files
pythonnet https://github.com/pythonnet
pythonnethttps://github.com/pythonnet/pythonnet
Notifications https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 770 https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://github.com/pythonnet/pythonnet
Issues 155 https://github.com/pythonnet/pythonnet/issues
Pull requests 18 https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects 0 https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/pythonnet/pythonnet/security
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
Insights https://github.com/pythonnet/pythonnet/pulse
Code https://github.com/pythonnet/pythonnet
Issues https://github.com/pythonnet/pythonnet/issues
Pull requests https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
den-run-aihttps://github.com/den-run-ai
pythonnet:masterhttps://github.com/pythonnet/pythonnet/tree/master
dsuarezv:missing_funchttps://github.com/dsuarezv/pythonnet/tree/missing_func
Conversation 16 https://github.com/pythonnet/pythonnet/pull/461
Commits 9 https://github.com/pythonnet/pythonnet/pull/461/commits
Checks 0 https://github.com/pythonnet/pythonnet/pull/461/checks
Files changed https://github.com/pythonnet/pythonnet/pull/461/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
Implement named arguments and With semantics in C# embedding side https://github.com/pythonnet/pythonnet/pull/461/files#top
Show all changes 9 commits https://github.com/pythonnet/pythonnet/pull/461/files
73c40fc Added python "with" construction dsuarezv May 6, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/73c40fc6d484acaed68514955963a5512d086739
500d3d3 Added some unit tests for new With method dsuarezv May 6, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/500d3d37a05e77b9f24f00431e5a8b9d03b77b26
35a7dc6 Renamed With tests for easier grouping dsuarezv May 6, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/35a7dc648841d543fef88e11d8206cb541475980
c3c1c56 Support for named arguments to invoke python methods dsuarezv May 6, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/c3c1c5643e75fffd9a6b8911ade126d9564509f4
6c27e84 Named argument tests cosmetic changed dsuarezv May 6, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/6c27e84a988863152f2b2fcaf433f8a0465c4141
a31c590 Merge branch 'master' into missing_func filmor May 16, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/a31c590fba627a9e271aa843f2bb51e03418dd53
66864ad Fixed failing test in python 2.7 dsuarezv May 18, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/66864add513720fd43dedd2cf9ab61f38212fe5d
93b1bda Reset line endings in csproj to LF dsuarezv May 18, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/93b1bda3533e71690ea5225abf7a6e2f9a121fb1
9f1c378 Merge branch 'master' into missing_func dsuarezv May 24, 2017 https://github.com/pythonnet/pythonnet/pull/461/commits/9f1c378eab3609d99c5314540792cb95f47b7731
Clear filters https://github.com/pythonnet/pythonnet/pull/461/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
Python.EmbeddingTest.csproj https://github.com/pythonnet/pythonnet/pull/461/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
TestNamedArguments.cs https://github.com/pythonnet/pythonnet/pull/461/files#diff-9e9ebc97ccf8fef5e138aec5ea287e304ded7c9bfd85cb44872d3ca9cd97990a
TestPyWith.cs https://github.com/pythonnet/pythonnet/pull/461/files#diff-604b81fa818fadeb87684e2c1f5fbb8c1f8bc871b66e1be869a8adc9eac65331
pyobject.cs https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
pythonengine.cs https://github.com/pythonnet/pythonnet/pull/461/files#diff-59c1255540fe4fce6bd6d1f2b5b31ced7b9baacc387b3d07cb08e9444bcd82aa
src/embed_tests/Python.EmbeddingTest.csprojhttps://github.com/pythonnet/pythonnet/pull/461/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
View file https://github.com/dsuarezv/pythonnet/blob/9f1c378eab3609d99c5314540792cb95f47b7731/src/embed_tests/Python.EmbeddingTest.csproj
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/461/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/461/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
https://github.com/pythonnet/pythonnet/pull/461/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
https://github.com/pythonnet/pythonnet/pull/461/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
src/embed_tests/TestNamedArguments.cshttps://github.com/pythonnet/pythonnet/pull/461/files#diff-9e9ebc97ccf8fef5e138aec5ea287e304ded7c9bfd85cb44872d3ca9cd97990a
View file https://github.com/dsuarezv/pythonnet/blob/9f1c378eab3609d99c5314540792cb95f47b7731/src/embed_tests/TestNamedArguments.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/461/{{ revealButtonHref }}
src/embed_tests/TestPyWith.cshttps://github.com/pythonnet/pythonnet/pull/461/files#diff-604b81fa818fadeb87684e2c1f5fbb8c1f8bc871b66e1be869a8adc9eac65331
View file https://github.com/dsuarezv/pythonnet/blob/9f1c378eab3609d99c5314540792cb95f47b7731/src/embed_tests/TestPyWith.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/461/{{ revealButtonHref }}
src/runtime/pyobject.cshttps://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
View file https://github.com/dsuarezv/pythonnet/blob/9f1c378eab3609d99c5314540792cb95f47b7731/src/runtime/pyobject.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/461/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
filmorhttps://github.com/filmor
May 10, 2017https://github.com/pythonnet/pythonnet/pull/461/files#r115692822
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
filmorhttps://github.com/filmor
May 10, 2017https://github.com/pythonnet/pythonnet/pull/461/files#r115692952
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
dsuarezvhttps://github.com/dsuarezv
May 18, 2017https://github.com/pythonnet/pythonnet/pull/461/files#r117309948
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
filmorhttps://github.com/filmor
May 10, 2017https://github.com/pythonnet/pythonnet/pull/461/files#r115693213
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/461/files
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
https://github.com/pythonnet/pythonnet/pull/461/files#diff-c7afe47ee5bee58846cafad6ec4ecedb222d846124e7aec56bb7f62df0340392
src/runtime/pythonengine.cshttps://github.com/pythonnet/pythonnet/pull/461/files#diff-59c1255540fe4fce6bd6d1f2b5b31ced7b9baacc387b3d07cb08e9444bcd82aa
View file https://github.com/dsuarezv/pythonnet/blob/9f1c378eab3609d99c5314540792cb95f47b7731/src/runtime/pythonengine.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/461/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/461/files#diff-59c1255540fe4fce6bd6d1f2b5b31ced7b9baacc387b3d07cb08e9444bcd82aa
https://github.com/pythonnet/pythonnet/pull/461/files#diff-59c1255540fe4fce6bd6d1f2b5b31ced7b9baacc387b3d07cb08e9444bcd82aa
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.