473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

funcs without () like print

iwl
Hello can I make funktions callable without () like print
at time the interpreter seems to printout the adres when I type the
function without ()

Dec 7 '06 #1
4 992
"iwl" <In*******@gmx.dewrote:
Hello can I make funktions callable without ()
no, not really.
like print at time the interpreter seems to printout the adres when I type the
function without ()
the interpreter does repr() on the object (which calls the __repr__ method),
and prints the result.

</F>

Dec 7 '06 #2
iwl wrote:
Hello can I make funktions callable without () like print
at time the interpreter seems to printout the adres when I type the
function without ()
print is not a function, it's a statement, and as such equivalent to
raise or assert.

Georg
Dec 7 '06 #3

iwl wrote:
Hello can I make funktions callable without () like print
at time the interpreter seems to printout the adres when I type the
function without ()
Hi iwl,
its one of the python fundamentals when dealing with functions.

function_name without the () refers to the function object, that can be
passed around like any other object.
function_name() with the () calls the object referred to by the
function name, attempting to execute the code within it.

So no. you can't call functions without the (), but python provides an
easy way to know when you are calling a function or not: just look for
the ().

- Paddy.

Dec 7 '06 #4
iwl wrote:
Hello can I make funktions callable without () like print
at time the interpreter seems to printout the adres when I type the
function without ()
As everyone else has already told you, print is a statement, not a
function. If you want your source code to use these "self-calling-
functions," you should change your wishes.

If, however, you are talking solely about the interactive prompt and
ease of typing, you might want to check out ipython (find via your
favorite search tool). Its flexibility may well be to your taste.

--Scott David Daniels
sc***********@acm.org
Dec 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: David Rysdam | last post by:
Getting no answer yesterday, I've done some investigation and I obviously don't understand how python namespaces work. Here's a test program: #!/usr/bin/python b = 2 def sumWithGlobal(a):...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
1
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is...
5
by: Alan | last post by:
While not rs.eof <td><%=rs("InvoiceNo")%></td> <td><%=rs("Name")%></td> <td><a href="InvoicePrint.asp?WInv=<%=rs("InvoiceNo")%>"></a></td> <td>Print this invoice</td> rs.MoveNext Wend Now...
3
by: John Peterson | last post by:
Hello all! I'm at my wits end trying to search for what I assumed to be a relatively straightforward task. I have a Web application written in C#, and I have a button on the form that I want to...
3
by: George Sakkis | last post by:
I'm trying to figure out why Popen captures the stderr of a specific command when it runs through the shell but not without it. IOW: cmd = if 1: # this captures both stdout and stderr as...
0
by: DarrenWeber | last post by:
# Copyright (C) 2007 Darren Lee Weber # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free...
5
by: dmitrey.kroshko | last post by:
hi all, I need to create a Python list of lambda-funcs that are dependent on the number of the ones, for example F = for i in xrange(N): F.append(lambda x: x + i) however, the example...
6
by: SanPy | last post by:
The subject of this message might be a little cryptic, so here's an example of what I mean: def foo(): """doc string of foo""" print foo.__doc__ doc string of foo What I want to know is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.