473,387 Members | 1,492 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,387 software developers and data experts.

HC Library and *attributes parameter

Hello,

I'm a really new (and quite bad) Python programmer. While trying to use
the HC HTML-Generating library, I couldn't figure out how to set a table's
width to some given width. Moreover, the constructors interface is

def __init__(self, object = None, align = None, border = None, cellspacing =
None, cellpaddding = None, *attributes)

So, what does *attribute stand for (being a C++ programmer, it looks
like a pointer, probably not the case). Is it like the C++ ellipsis? If so,
how can
I use it?

Thanks,

Efrat
Jul 18 '05 #1
3 1123
Efrat Regev wrote:
def __init__(self, object = None, align = None, border = None, cellspacing =
None, cellpaddding = None, *attributes)

So, what does *attribute stand for (being a C++ programmer, it looks
like a pointer, probably not the case). Is it like the C++ ellipsis? If so,
how can
I use it?


Your guess is pretty close. See here for details:

http://docs.python.org/ref/calls.html#calls

-Peter
Jul 18 '05 #2
Efrat Regev wrote:
Hello,

I'm a really new (and quite bad) Python programmer. While trying to use
the HC HTML-Generating library, I couldn't figure out how to set a table's
width to some given width. Moreover, the constructors interface is

def __init__(self, object = None, align = None, border = None, cellspacing =
None, cellpaddding = None, *attributes)

So, what does *attribute stand for (being a C++ programmer, it looks
like a pointer, probably not the case). Is it like the C++ ellipsis? If so,
how can
I use it?

The notation "*attribute" in the function signature denotes a variable
number of positional arguments, which are provided to the function body
as a tuple named attribute.
def f1(a, b, *c): ... print "a:", a
... print "b:", b
... print "c:", c
... f1(1, 2, 3, 4, 5) a: 1
b: 2
c: (3, 4, 5) f1('one', 'two') a: one
b: two
c: ()


Much easier than varargs in C!

The notation **kw similarly denotes a variable number of keyword
arguments, which are provided to the function body as a dictionary named kw.

regards
Steve

Jul 18 '05 #3

"Efrat Regev" <ef*********@yahoo.com> wrote in message
news:5p********************@adelphia.com...
Hello,
...


Many thanks for the useful replies!!
Jul 18 '05 #4

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

Similar topics

9
by: Francis Avila | last post by:
A little annoyed one day that I couldn't use the statefulness of generators as "resumable functions", I came across Hettinger's PEP 288 (http://www.python.org/peps/pep-0288.html, still listed as...
1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
1
by: Chris | last post by:
Hi, I just would like to iterate through some attributes of a tag (Section). Sometimes I only need one attribute and sometimes I need all attributes. In a xsl:param I declare the attribute name...
6
by: shablool | last post by:
Hi all! The Strinx library is an efficient and easy-to-use string library. It is written in C++, using modern template approach. It uses a class hierarchy to implement a set of string objects...
0
by: Paul Rees | last post by:
I am wondering if anyone has encountered a similar problem to the one that I am having. I have an ASP.NET page which has a table and a dropdownlist that was added at design time. The majority of...
1
by: LG | last post by:
I want to add attributes to a custom dropdownlist and I found some code on Internet that doesn't work after post back. First time the control has the attributes, but after postback the attributes...
0
by: xieml2007 | last post by:
Dear Madam or Sir, I encountered one problem which is quite similiar to the discussions launched at the web site: http://www.thescripts.com/forum/thread280324.html
0
by: Nathan Sokalski | last post by:
I am attempting to add Attributes to my ASP.NET Controls & Properties. Here is what my Controls look like: <ToolboxData("<{0}:Parameter runat=""server""/>")_ Public Class Parameter : Inherits...
40
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.