<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
class entry:<br>
filename = None<br><br>
def __init__(self, name, value, filename=None):<br>
<a href="http://self.name/" target="_blank">self.name</a> = name<br>
self.value = value<br>
if filename is not None:<br>
self.filename = filename<br><br>
[entry('name', 'Gabriel'), entry('age', 18), entry('pic', picture_data, 'path/to/file')]</blockquote><div> </div>
Gabriel thank you for this. I just now realized I've being doing things the hard way. :)<br clear="all">-Alex Goretoy<br><a href="http://www.alexgoretoy.com">http://www.alexgoretoy.com</a><br><a href="mailto:somebodywhocarez@gmail.com">somebodywhocarez@gmail.com</a><br>
<br><br><div class="gmail_quote">On Mon, Jan 5, 2009 at 8:58 PM, Gabriel Genellina <span dir="ltr"><<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
En Sat, 03 Jan 2009 02:55:12 -0200, Kottiyath <<a href="mailto:n.kottiyath@gmail.com" target="_blank">n.kottiyath@gmail.com</a>> escribió:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
tuples = [(1, 2), (3, 4, 5), (6, 7)]<br>
</blockquote>
<br></div><div class="Ih2E3d">
It is a code to post some data to HTML server.<br>
Even though usually the POST values are of type(name, value), if file<br>
transfer is involved, then POST values change to (name, filename,<br>
value).<br>
My view was that since filename is a rare occurance and doesnt make<br>
sense in a usual POST, I had not kept it as a full 3 tuple.<br>
Since so many programmers (that too much more capable than me) are<br>
suggesting that it is code smell, I am reviewing my decision.<br>
</div></blockquote>
<br>
What about using another data structure instead - like this:<br>
<br>
class entry:<br>
filename = None<br>
<br>
def __init__(self, name, value, filename=None):<br>
<a href="http://self.name" target="_blank">self.name</a> = name<br>
self.value = value<br>
if filename is not None:<br>
self.filename = filename<br>
<br>
[entry('name', 'Gabriel'), entry('age', 18), entry('pic', picture_data, 'path/to/file')]<br>
<br>
-- <br><font color="#888888">
Gabriel Genellina</font><div><div></div><div class="Wj3C7c"><br>
<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>