Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

arguments

How do I pass args and kwargs to a REST endpoint built with FastAPI?

August 22, 2022 by Magenaut

I am building a REST api using FastAPI. The goal is to run a python function over the network and return the result.

Categories Python, Q&A Tags arguments, fastapi, keyword-argument, python Leave a comment

How to pass arguments to a Button command in Tkinter?

August 22, 2022 by Magenaut

Suppose I have the following Button made with Tkinter in Python:

Categories Python, Q&A Tags arguments, button, python, python-3.x, tkinter Leave a comment

TypeError: method() takes 1 positional argument but 2 were given

August 21, 2022 by Magenaut

If I have a class…

Categories Python, Q&A Tags arguments, methods, python, python-3.x, self Leave a comment

Normal arguments vs. keyword arguments

August 21, 2022 by Magenaut

How are “keyword arguments” different from regular arguments? Can’t all arguments be passed as name=value instead of using positional syntax?

Categories Python, Q&A Tags arguments, keyword, named-parameters, optional-parameters, python Leave a comment

How to expand a list to function arguments in Python

August 19, 2022 by Magenaut

Is there syntax that allows you to expand a list into the arguments of a function call? Example: # Trivial example function, not meant to do anything useful. def foo(x,y,z): return "%d, %d, %d" %(x,y,z) # List of values that I want to pass into foo. values = [1,2,3] # I want to do something … Read more

Categories Python, Q&A Tags arguments, python Leave a comment

How do I create a Python function with optional arguments?

August 18, 2022 by Magenaut

I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios.

Categories Python, Q&A Tags arguments, function, optional-arguments, python Leave a comment

Python: Passing variables between functions

August 18, 2022 by Magenaut

I’ve spent the past few hours reading around in here and elsewhere, as well as experimenting, but I’m not really understanding what I am sure is a very basic concept: passing values (as variables) between different functions.

Categories Python, Q&A Tags arguments, function, python Leave a comment

Cannot pass an argument to python with “#!/usr/bin/env python”

August 17, 2022 by Magenaut

I needed to have a directly executable python script, so i started the file with #!/usr/bin/env python. However, I also need unbuffered output, so i tried #!/usr/bin/env python -u, but that fails with python -u: no such file or directory.

Categories Python, Q&A Tags arguments, python, shebang Leave a comment

How can I read a function’s signature including default argument values?

August 16, 2022 by Magenaut

Given a function object, how can I get its signature? For example, for:

Categories Python, Q&A Tags arguments, inspect, python Leave a comment

Best way to check function arguments?

August 16, 2022 by Magenaut

isinstance(obj, type) function takes your variable, obj and gives you True is it is the same type of the type you listed.

Categories Python, Q&A Tags arguments, function, python Leave a comment
Older posts
Page1 Page2 … Page4 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress