Skip to content

Magenaut

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

function

Understanding Python’s call-by-object style of passing function arguments

August 19, 2022 by Magenaut

I am not sure I understand the concept of Python’s call by object style of passing function arguments (explained here http://effbot.org/zone/call-by-object.htm). There don’t seem to be enough examples to clarify this concept well (or my google-fu is probably weak! :D)

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

Call a function with argument list in python

August 19, 2022 by Magenaut

I’m trying to call a function inside another function in python, but can’t find the right syntax. What I want to do is something like this:

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

How to send an email with Python?

August 18, 2022 by Magenaut

This code works and sends me an email just fine:

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

Is there an easy way to pickle a python function (or otherwise serialize its code)?

August 18, 2022 by Magenaut

I’m trying to transfer a function across a network connection (using asyncore). Is there an easy way to serialize a python function (one that, in this case at least, will have no side effects) for transfer like this?

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

How to plot multiple functions on the same figure, in Matplotlib?

August 18, 2022 by Magenaut

How can I plot the following 3 functions (i.e. sin, cos and the addition), on the domain t, in the same figure?

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

Why do some functions have underscores “__” before and after the function name?

August 18, 2022 by Magenaut

This “underscoring” seems to occur a lot, and I was wondering if this was a requirement in the Python language, or merely a matter of convention?

Categories Python, Q&A Tags double-underscore, function, methods, python Leave a comment

How to pass an operator to a python function?

August 18, 2022 by Magenaut

I’d like to pass a math operator, along with the numeric values to compare, to a function. Here is my broken code:

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

Function changes list values and not variable values in Python

August 18, 2022 by Magenaut

Let’s take a simple code: y = [1,2,3] def plusOne(y): for x in range(len(y)): y[x] += 1 return y print plusOne(y), y a = 2 def plusOne2(a): a += 1 return a print plusOne2(a), a Values of ‘y’ change but value ‘a’ stays the same. I have already learned that it’s because one is mutable … Read more

Categories Python, Q&A Tags function, list, nested-lists, python, variables Leave a comment

Doing something before program exit

August 18, 2022 by Magenaut

How can you have a function or something that will be executed before your program quits? I have a script that will be constantly running in the background, and I need it to save some data to a file before it exits. Is there a standard way of doing this?

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

Difference between methods and functions, in Python compared to C++

August 18, 2022 by Magenaut

I’m doing Code Academy’s tutorials on Python, and I’m a bit confused about the definition of method and function. From the tutorial:

Categories Python, Q&A Tags function, methods, oop, python Leave a comment
Older posts
Newer posts
← Previous Page1 … Page3 Page4 Page5 … Page11 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