How can you unit test nested functions? Or do you have to pull them out to
unit test them, which basically means I will never use nested functions.
Also, same thing with private member functions protected by __. Seems like
there is a conflict there between using these features and unit testing
Grant Edwards wrote:
[snip..]
> Personally, I don't really like the idea that falling off the
> botton of a function implicitly returns None. It's just not
> explicit enough for me. My preference would be that if the
> function didn't execute a "return" statement, then it didn't
> return anyting
"Andrew Dalke" <[EMAIL PROTECTED]> wrote:
> [snipped]
>
> > Take for example the case where a PhoneNumber class is subclass
> > of int. According to LSP, it is perfectly ok to add phone numbers
> > together, subtract them, etc, but the result, even if it's a valid
> > phone number, just doesn't ma
Grant Edwards wrote:
> Personally, I don't really like the idea that falling off the
> botton of a function implicitly returns None. It's just not
> explicit enough for me. My preference would be that if the
> function didn't execute a "return" statement, then it didn't
> return anyting and atte
George Sakkis wrote:
> That's why phone numbers would be a subset of integers, i.e. not every
> integer would correspond to a valid number, but with the exception of
> numbers starting with zeros, all valid numbers would be an integers.
But it's that exception which violates the LSP.
With numbers
On Fri, 22 Jul 2005 08:38:28 -0400, Peter Hansen wrote:
> Steven D'Aprano wrote:
>> It may shock some people to learn that difference in the sense of
>> mathematical subtraction is not the only meaning of the word, but there
>> it is. One wouldn't, I hope, misunderstand "What is the difference
On Fri, 22 Jul 2005 06:07:28 -0700, Robert Kern wrote:
> Francois De Serres wrote:
>> hiho,
>>
>> what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to
>> the string 'spam'?
>
> In [1]: t = (0x73, 0x70, 0x61, 0x6D)
>
> In [2]: ''.join(chr(x) for x in t)
> Out[2]: 'spam'
I ge
Andy wrote:
> How can you unit test nested functions?
I can't think of a good way. When I write a nested function it's because
the function uses variables from the scope of the function in which it's
embedded, which means it makes little sense to test it independent of the
larger function.
My te
On Fri, 22 Jul 2005 07:59:42 -0700, scrimp wrote:
> I am using reportlab not to generate PDF files,
Isn't that amazing! I'm also using reportlab not to generate PDF files
too! I installed the program, and it just sits there, not generating as
many PDF files as I don't want for as long as I don't
Hi,
I often wish for a really high-level way to access db results, being
willing to forego some efficiency. I came up with a class you can use
like:
cur = db.cursor()
cur.execute('select abc, def from blah')
for row in dbcur_iter(cur):
print row['abc'], row['def']
Here's the class:
Hello.
I would like to have a quick way to create dicts from object, so that a
call to foo['bar'] would return obj.bar.
The following works, but I would prefer to use a built-in way if one
exists. Is there one?
Thanks in advance.
class dictobj(dict):
"""
class dictobj(dict):
A dict
Thanos Tsouanas a écrit :
> Hello.
>
> I would like to have a quick way to create dicts from object, so that a
> call to foo['bar'] would return obj.bar.
>
> The following works, but I would prefer to use a built-in way if one
> exists. Is there one?
>
> Thanks in advance.
>
> class dictobj(di
Thanos Tsouanas wrote:
> Hello.
>
> I would like to have a quick way to create dicts from object, so that a
> call to foo['bar'] would return obj.bar.
>
> The following works, but I would prefer to use a built-in way if one
> exists. Is there one?
>
> class dictobj(dict):
> """
> class
Hi Stani,
Downloaded your latest SPE editor 0.7.4.m . I'm running wxPython 2.6.1
on a Fedora Core 4 machine. The IDE is great but guess what it crashes
without warning. Was typing some code and boom the whole thing
disappeared without a trace. Thought should let you know
All you guys using this I
Rob Cowie a écrit :
> Hi,
>
> I need to create a planner/calendar system using python cgi scripts. It
> is my first CGI app (beyond a few tutorial examples).
>
(snip)
You may want to have a look at the cgi_app mini-framework:
-> http://thraxil.org/code/cgi_app/
It's a port of a Perl framework,
Little less ugly:
In [12]:class A(object):
: def __str__(self):return self.__str__()
: def str(self):return 'ciao'
: def setStr(self):self.__str__=self.str
:
In [13]:a=A()
In [14]:a.setStr()
In [15]:str(a)
Out[15]:'ciao'
The point is str(ob) builtin l
Hi,
the arguments in the previous thread were convincing enough, so I made the
Path class inherit from str/unicode again.
It still can be found in CVS:
/python/nondist/sandbox/path/{path.py,test_path.py}
One thing is still different, though: a Path instance won't compare to a regular
string.
O
On Sat, Jul 23, 2005 at 12:06:57PM +0200, Paolino wrote:
> use getattr(self.obj,key) possibly, as __getattribute__ gets total
> control on attribute access
Thanks, but what do you mean by 'total control'?
--
Thanos Tsouanas .: My Music: http://www.thanostsouanas.com/
http://thanos.sian
On Sat, Jul 23, 2005 at 11:30:19AM +0200, Bruno Desthuilliers wrote:
> Thanos Tsouanas a écrit :
> > class dictobj(dict):
> > """
> > class dictobj(dict):
> > A dictionary d with an object attached to it,
> > which treats d['foo'] as d.obj.foo.
> > """
> > def __init__(self,
The original message was included as attachment
This part of message has been infected and was deleted!
Dr.Web(R) Daemon report:
infected with Win32.HLLM.MyDoom.49
---
Dr.Web(R) Antivirus Service: http://www.drweb.com/
-
Dear All,
I am using Python 2.4 in the linux platform.
At present I am working on webbased file manager.
When I try to upload a file from the linux cgi
script easily fetch the file name by the
filefield.filename. But When I try to upload
a file from the windows machine It won't
retrieve the
Steven D'Aprano wrote:
> On Fri, 22 Jul 2005 06:07:28 -0700, Robert Kern wrote:
> ... or even:
>
''.join(map(lambda n: chr(n), (0x73, 0x70, 0x61, 0x6D)))
>
> 'spam'
This is exactly what is wrong with lambda. It yearns for over-use.
This last should be:
>>>''.join(map(chr, (0x73, 0x70, 0x6
Thanos Tsouanas wrote:
> On Sat, Jul 23, 2005 at 12:06:57PM +0200, Paolino wrote:
>
>>use getattr(self.obj,key) possibly, as __getattribute__ gets total
>>control on attribute access
>
>
> Thanks, but what do you mean by 'total control'?
>
Probably nothing to do with your question :(
But:
>>>
Jeffrey E. Forcier wrote:
> ...
> However, you appear to be correct, and the docs appear to be confused:
> class MyClass(object):
> def edit(self):
> return "I'm in edit mode"
> def setEdit(self):
> MyClass.__str__ = self.edit
> ...
> Either way, gues
Thanos Tsouanas a écrit :
> On Sat, Jul 23, 2005 at 12:06:57PM +0200, Paolino wrote:
>
>>use getattr(self.obj,key) possibly, as __getattribute__ gets total
>>control on attribute access
>
>
> Thanks, but what do you mean by 'total control'?
__getattribute__ is really some kind of an evil blac
On Wed, 13 Jul 2005 11:09:57 +0300, Edvard Majakari <[EMAIL PROTECTED]> wrote:
>
> Suppose one wants to fetch the following data from given network interface,
> say, eth0:
>
Ethinf('eth0').addr()
> '192.168.1.42/24'
...
Ethstat('eth0').rx_bytes()
> 14325235341223
...
> One could implement
I am preparing to release an extension module that interfaces Python to
the Class Library for Numbers (http://www.ginac.de/CLN/). This module
will provide Python types for arbitrary precision floating point
numbers, rational numbers, and their complex counterparts. The module
also includes most o
On Sat, 23 Jul 2005 11:48:27 +0300, Thanos Tsouanas wrote:
> Hello.
>
> I would like to have a quick way to create dicts from object, so that a
> call to foo['bar'] would return obj.bar.
That looks rather confusing to me. Why not just call obj.bar, since it
doesn't look like you are actually usi
On Fri, 22 Jul 2005 12:42:04 +, Odd-R. wrote:
> On 2005-07-22, John Machin <[EMAIL PROTECTED]> wrote:
>> Odd-R. wrote:
>>> I have this list:
>>>
>>> [{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}]
>>>
>>> All the dictionaries of this list are of the same form, and a
Michael Hoffman wrote:
> Reinhold Birkenfeld wrote:
> > Probably as Terry said: a path is both a list and a string.
[...]
> One way to divide this is solely based on path separators:
>
> ['c:', 'windows', 'system32:altstream', 'test.dir',
> 'myfile.txt.zip:altstream']
I would argue that any prop
Steven D'Aprano wrote:
>
>
''.join(map(lambda n: chr(n), (0x73, 0x70, 0x61, 0x6D)))
>
> 'spam'
Why the verbal diarrhoea? What's wrong with the (already posted)
''.join(map(chr, (0x73, 0x70, 0x61, 0x6D)))
???
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> John Machin wrote:
>
>>Reinhold Birkenfeld wrote:
>>
>>>Berthold Höllmann wrote:
>>>
>>>
Francois De Serres <[EMAIL PROTECTED]> writes:
>hiho,
>
>what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D)
>to the string 'spa
John Machin wrote:
> Reinhold Birkenfeld wrote:
>>Ah, ok. Didn't want to lookup the precedence rules...
>
> Look up the precedence rules? Are you aware of any language where * /
> and % _don't_ have the same precedence??
Given that % is somewhat more esoteric, I certainly have never committed
Reinhold Birkenfeld wrote:
> One thing is still different, though: a Path instance won't compare to a
> regular
> string.
Could you please expand on what this means? Are you referring to doing
< and >= type operations on Paths and strings, or == and != or all those
or something else entirely?
George Sakkis wrote:
> "Andrew Dalke" <[EMAIL PROTECTED]> wrote:
>>I think that the string representation of a path is so important that
>>it *is* the path.
>
> There are (at least) two frequently used path string representations,
> the absolute and the relative to the working directory. Which o
Peter Hansen wrote:
> Under Linux isn't it possible to open and read from directories much as
> with files?
Not really, no.
Python 2.3.4 (#2, Jan 5 2005, 08:24:51)
[GCC 3.3.5 (Debian 1:3.3.5-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> d = open('/us
Thanks for all the additional replies thus far!
Apparently the issue, as stated implicitly or explicitly by most of
you, is that new-style class instances essentially defer their magic
methods to the class's static versions of same. This is good to know :)
Ironically, the reason I'm using new
this isn't really enough data to go on. What operating system (sounds
like win2k/XP), does Crystal reports and unnamed accounting software
have COM hooks?
Look at Simon Brunning posts:
http://www.brunningonline.net/simon/blog/archives/000652.html
http://aspn.activestate.com/ASPN/Cookbook/Python/
Hello all,
I have written a simple whiteboard application. In my application, I
want to be able to set draw attributes. This part works. I have a
dictionary object which contains stuff like:
self.attr['Pen.Color'] = ...
self.attr['Pen.Thickness'] = ...
Now, the problem is that I want to be
Peter Hansen wrote:
> Reinhold Birkenfeld wrote:
>> One thing is still different, though: a Path instance won't compare to a
>> regular
>> string.
>
> Could you please expand on what this means? Are you referring to doing
> < and >= type operations on Paths and strings, or == and != or all thos
Hi all,
My query goes like this.
I have two htm files.One is media_try_home.htm and the second one is
media_try.htm.I am attaching these files to my mail so that you guys can
understand the problem.
Now, first simply open the media_try_home.htm and press "PLAY THE FILE"
button.A video clip
There's a few places to stash apps, libraries, or small code snippets
so they can be search engined, if you provide some inline comments,
unit/functional tests, and examples of how to use/known limitations:
Vaults Parnassus, dmoz, ActiveState cookbook
http://aspn.activestate.com/ASPN/Cookbook/Pyth
Hi,
I have also been looking around to start web development.
Almost everybody says - "Zope h steep learning curve", so looking
at alternatives. But to people have got past that curve. Is Zope worth
it.
My applications would be data entry heavy. Think inventory and accounting apps.
Would goi
I've observed something strange about property docstrings and I'm
wondering if anyone here can clarify what's going on: if I create a class
derived from property, the docstrings of the instances end up being that
of the derived class, not the docstring passed into the property
constructor. Examp
Jan Danielsson wrote:
> Hello all,
>
>I have written a simple whiteboard application. In my application, I
> want to be able to set draw attributes. This part works. I have a
> dictionary object which contains stuff like:
> self.attr['Pen.Color'] = ...
> self.attr['Pen.Thickness'] = ...
>
>
Dark Cowherd wrote:
> My applications would be data entry heavy. Think inventory and accounting
> apps.
>
> Would going past the [Zope] learning curve allow me to write applications
> like that.
You might want to look at Zope 3, there are several niceties for
automatically (or semi-automatica
[Andy]
> How can you unit test nested functions? Or do you have to pull them out to
> unit test them, which basically means I will never use nested functions.
Several commons use cases (closures and factory functions) ultimately
expose the inner function through the return value. If that is the
Raymond Hettinger wrote:
> [Andy]
>>How can you unit test nested functions?
> For whitebox testing, you could make an inner function visible by
> binding it to the enclosing function's attribute namespace.
>
>def f(x):
>def g(y):
> . . .
>f.g = g# make g vis
On 7/19/05, Alberto Vera <[EMAIL PROTECTED]> wrote:
> Hello:
>
> Do you know If the smtplib routine have been changed in last releases?
>
> I used this script:
>
> http://docs.python.org/lib/SMTP-example.html
>
> but it didn't work with the last release.
>
> Do you know any idea about thi
I have a friend who wants to learn python programming. I learned off
the internet and have never used a book to learn it. What books do you
recommend?
Any suggestions would be appreciated.
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> Peter Hansen wrote (on Paths not allowing comparison with strings):
>>Could you please expand on what this means? Are you referring to doing
>>< and >= type operations on Paths and strings, or == and != or all those
>>or something else entirely?
>
> All of these. Do
> > [sj]
> >> Thus, random access is an O(1) operation while insertion/deletion is an
> >> O(n) operation.
[Raymond Hettinger]
> > Yes.
[Heikki Orsila aka host.invalid]
> Unfortunately no. Check Terry Reeds answer. Random access is O(1),
> insertion/deletion to front is O(n), and i/d to back is O
Hi all,
Just having started with python, I feel that simple array operations '*'
and '+' don't do multiplication/addition but instead extend/join an
array:
a=[1,2,3]
>>> b=[4,5,6]
>>> a+b
[1, 2, 3, 4, 5, 6]
instead of what I would have expected:
[5,7,9]
or
>>> 2*a
[1, 2, 3, 1, 2, 3]
Well it i
> better to go with SQLite. Its cross platform and well proven. I think
> Firebird will give you that too, though I have never used it.
>
Firebird is a great option, cross platform, it can work like access
without any server running, using embedded mode to a full blown server
which can handle t
Peter Hansen wrote:
> Just a note, though you probably know, that this is intended to be
> written this way with path:
>
> >>> p / q
> path(u'a/b/c/d')
I know, but it really doesn't look right to me.
I think that my fundamental problem with all of this is that by making path
a subclass of str/
Hi,
I don't know anything about PHP and I'm initiating right now with
PostgreSQL.
Could someone tell me the pros and cons of assessing the PostgreSQL
databases with Python vs. PHP?
I will need to build a database that has to be assessed by a dozen clients
via a web page in an intranet (possibly
> > [Andy]
> >>How can you unit test nested functions?
[Raymond Hettinger]
> > For whitebox testing, you could make an inner function visible by
> > binding it to the enclosing function's attribute namespace.
> >
> >def f(x):
> >def g(y):
> > . . .
> >f.g = g#
I have a friend who wants to learn python programming. I learned off
the internet and have never used a book to learn it. What books do you
recommend?
Any suggestions would be appreciated.
--
http://mail.python.org/mailman/listinfo/python-list
I would like to write a Python code like this:It can login a host by SSHafter login the host, use SCP to get a remote file, so it can deliver file to the host.then execute the programthen leave the hostFor example :STEP 1. ssh [EMAIL PROTECTED]STEP 2. Enter the password automatically STEP 3. run "
<[EMAIL PROTECTED]> wrote:
> Jan Danielsson wrote:
> > Hello all,
> >
> >I have written a simple whiteboard application. In my application, I
> > want to be able to set draw attributes. This part works. I have a
> > dictionary object which contains stuff like:
> > self.attr['Pen.Color'] = ...
Maybe diveintopython.org can help
--
http://mail.python.org/mailman/listinfo/python-list
I would like to write a Python code like this:It can login a host by SSHafter login the host, use SCP to get a remote file, so it can deliver file to the host.then execute the programthen leave the hostFor example :STEP 1. ssh _yyy at 123.45.67.89STEP 2. Enter the password automatically STEP 3.
[EMAIL PROTECTED] writes:
> I am seeing negative latencies of up to 1 second. I am using ntp to
> synchronize both machines at an interval of 2 seconds, so the clocks
> should be very much in sync (and are from what I have observed). I
> agree that it is probably OS, perhaps I should hop over t
To be honest, this is a pretty open-ended question. Are there specific
issues (SQL injection/security, minimizing db connections, simplest
code, etc, your'e concerned with?)
To be more honest, googline "Python vs. PHP" raises lots of hits
http://wiki.w4py.org/pythonvsphp.html
http://www.redcor.ch
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> On Sat, 23 Jul 2005 11:48:27 +0300, Thanos Tsouanas wrote:
>> Hello.
>>
>> I would like to have a quick way to create dicts from object, so that a
>> call to foo['bar'] would return obj.bar.
>
> That looks rather confusing to me. Why not just call obj.
ok, to make this less open-ended, you should mention what O/S and web
server you have in mind, whether the web and DB servers will be under
your admin (big diff betw python and PHP, as far as finding shared
server accounts at web hosts), what kinds of queries, concurrent
read/write volumes, transac
gene tani wrote:
> To be honest, this is a pretty open-ended question. Are there specific
> issues (SQL injection/security, minimizing db connections, simplest
> code, etc, your'e concerned with?)
Simplest code with be an important factor, since the db will be used far
from max capabilities. Eas
Peter Hansen <[EMAIL PROTECTED]> writes:
>> * staticmethod Path.getcwd() -> Path.cwd()
>> * bytes() / lines() / text() -> read_file_{bytes,lines,text} methods
>> * write_{bytes,lines,text} -> write_file_{bytes,lines,text} methods
> Under Linux isn't it possible to open and read from directories mu
Raymond Hettinger wrote:
> [Benji York]
>
>>Note that when using this technique, f.g will not be bound until after
>>you call the function:
>
>
> That is a feature, not a bug. The inner function isn't even created
> until the outer function is run.
I'm fully aware of that. I just didn't want
gene tani wrote:
> ok, to make this less open-ended, you should mention what O/S and web
> server you have in mind, whether the web and DB servers will be under
> your admin (big diff betw python and PHP, as far as finding shared
> server accounts at web hosts), what kinds of queries, concurrent
>
On Thu, 21 Jul 2005 00:45:12 +0200, red <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I'm writing a script for Blender and need to build a face array. My
>engine needs that all faces must be triangles, so I convert quads to
>triangles by dividing them into two triangles. Here is the function:
>
>def build_f
Jan Danielsson wrote:
> Hello all,
>
>I have written a simple whiteboard application. In my application, I
> want to be able to set draw attributes. This part works. I have a
> dictionary object which contains stuff like:
> self.attr['Pen.Color'] = ...
> self.attr['Pen.Thickness'] = ...
>
>
Soeren Sonnenburg wrote:
> Hi all,
>
> Just having started with python, I feel that simple array operations '*'
> and '+' don't do multiplication/addition but instead extend/join an
> array:
>
> a=[1,2,3]
This isn't an array. It is a list. If you want an array, use
Numeric/numarray. If you want
EnderLocke wrote:
> I have a friend who wants to learn python programming. I learned off
> the internet and have never used a book to learn it. What books do you
> recommend?
>
> Any suggestions would be appreciated.
>
I recommend "Learning Python 2nd Edition" by Mark Lutz & David Ascher
(O'Rei
I know how to make a hash(using mhash), but instead of encoded as hex I
want it in base32 for use with the bitzi catalog. python-bitzi is useful
but way too slow for just getting the hash of a file(am going to use it
elsewhere). Thanks.
Elmo
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
> Reinhold Birkenfeld wrote:
>> Peter Hansen wrote (on Paths not allowing comparison with strings):
>>>Could you please expand on what this means? Are you referring to doing
>>>< and >= type operations on Paths and strings, or == and != or all those
>>>or something else entir
* Kay Schluehr wrote:
> you might initialize self.storedAttr with empty dicts and fill them
> later:
>
> self.soredAttr = [{}]*10
> for entry in self.storedAttr:
> entry.update(self.drawAttr)
As a matter of fact, you're doing the same ;-)
In [1]: x = [{}] * 10
In [2]: x[0]['a'] = 1
In [3]
In <[EMAIL PROTECTED]>, Elmo Mäntynen wrote:
> I know how to make a hash(using mhash), but instead of encoded as hex I
> want it in base32 for use with the bitzi catalog. python-bitzi is useful
> but way too slow for just getting the hash of a file(am going to use it
> elsewhere). Thanks.
Doesn't
In <[EMAIL PROTECTED]>, Soeren
Sonnenburg wrote:
> Just having started with python, I feel that simple array operations '*'
> and '+' don't do multiplication/addition but instead extend/join an
> array:
>
> a=[1,2,3]
b=[4,5,6]
a+b
> [1, 2, 3, 4, 5, 6]
Both operate on the lists themselv
On Sat, 23 Jul 2005 07:05:05 +1000, John Machin <[EMAIL PROTECTED]> wrote:
>Daniel Dittmar wrote:
>> Duncan Booth wrote:
>>
>>> I would have expected a path object to be a sequence of path elements
>>> rather than a sequence of characters.
>>
>>
>> Maybe it's nitpicking, but I don't think th
On Sat, Jul 23, 2005 at 11:22:21PM +1000, Steven D'Aprano wrote:
> On Sat, 23 Jul 2005 11:48:27 +0300, Thanos Tsouanas wrote:
> > Hello.
> >
> > I would like to have a quick way to create dicts from object, so that a
> > call to foo['bar'] would return obj.bar.
>
> That looks rather confusing to
Hello!
> How well does PyGTK run on Windows (98, 2K, XP)? How stable is it? Will
> I be able to make an executable (using Py2Exe) of an application that
> uses PyGTK?
I _do_ like PyGTK on Windows. It works without problems.
You can find a ready to use py2exe script on
http://www.pythonwiki.de/PyG
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
>
> I'll look into it. What about iteration and indexing? Should it support
> "for element in path" or "for char in path" or nothing?
I frankly can't think of a use for iterating over the characters in
the path, b
On 21 Jul 2005 19:29:32 -0700, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
>[Will McGugan]
>> I need a collection class that behaves like a dictionary but when it
>> reaches 'n' items it discards the oldest item so that the length never
>> goes above 'n'. (Its for caching search results)
>
>
>i
On 7/19/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Is anyone know about a DB form generator unit under wxPython ?
> What that's means ?
>
> I add information about a Query, or a ListOfDict, I set some other infos
> (Lookups, others), and it is generate a Form with edit boxes, listboxes,
>
Grant Edwards wrote:
> Personally, I don't really like the idea that falling off the
> botton of a function implicitly returns None. It's just not
> explicit enough for me. My preference would be that if the
> function didn't execute a "return" statement, then it didn't
> return anyting and attem
Paolino wrote:
> Little less ugly:
> In [12]:class A(object):
>: def __str__(self):return self.__str__()
>: def str(self):return 'ciao'
>: def setStr(self):self.__str__=self.str
>:
>
> In [13]:a=A()
>
> In [14]:a.setStr()
>
> In [15]:str(a)
> Out[15]:'
Thanos Tsouanas wrote:
> I would like to have a quick way to create dicts from object, so that a
> call to foo['bar'] would return obj.bar.
>
> The following works, but I would prefer to use a built-in way if one
> exists. Is there one?
Maybe I'm not understanding your problem, but have you look
Luis P. Mendes wrote:
> I need to build it from the server and also client side.
>
> For the client side I'll be using Python.
>
> But for the server side, I would like to hear some opinions. Is it worth
> learning Php?
If you know Python and don't know PHP, there's little benefit from
spend
On Sat, 23 Jul 2005 18:30:29 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
[...]
>Did it work on a quad face? What about putting in a debug print before places
>you use
>f.normal, e.g.
>assert hasattr(f, 'normal'), 'This "f"\n\n%r\n\ndid not have a
> normal attribute!!' % f
>
>If f.re
On Saturday 23 July 2005 03:26 am, Steven D'Aprano wrote:
> On Fri, 22 Jul 2005 07:59:42 -0700, scrimp wrote:
> As others have suggested, if you have to deal with PDF files without
> Acrobat, you could use ghostscript. Also pre-installed on many versions
> of Linux, and probably other Unixes as wel
[Raymond Hettinger]
>>class Cache(dict):
>> def __init__(self, n, *args, **kwds):
>> self.n = n
>> self.queue = collections.deque()
>> dict.__init__(self, *args, **kwds)
[Bengt Richter]
> Minor comment: There is a potential name collision problem for keyword
> n=something,
>
On Sat, 23 Jul 2005 23:26:19 +1000, John Machin wrote:
> Steven D'Aprano wrote:
>
>>
>>
>''.join(map(lambda n: chr(n), (0x73, 0x70, 0x61, 0x6D)))
>>
>> 'spam'
>
> Why the verbal diarrhoea?
One line is hardly verbal diarrhoea.
> What's wrong with the (already posted)
>
> ''.join(map(ch
On Sat, 23 Jul 2005 23:31:04 +1000, John Machin wrote:
>>>You don't need the sissy parentheses; '%c' * len(t) % t works just fine :-)
>>
>>
>> Ah, ok. Didn't want to lookup the precedence rules...
>
>
> Look up the precedence rules? Are you aware of any language where * /
> and % _don't_ have
Reinhold Birkenfeld wrote:
[on comparing Paths and stings]
> Do you have a use case for the comparison? Paths should be compared only
> with other paths.
I can think of lots, though I don't know that I've used any in my
existing (somewhat limited) code that uses Path, but they all involve
cases
Christopher Subich wrote:
> print '%s returns:', retval
Not that it matters, but this line should be:
print '%s returns:' % func.__name__, retval
--
http://mail.python.org/mailman/listinfo/python-list
I decide to seperate my data collection routine from my data analysis
and storage program to a seperate process, so I try to use the new
subprocess model in Python 2.4.
The main program spawns the subprocess and receives data from the
pipe. When some event occurs (e.g. the user clicks the 'Stop'
On Sat, 23 Jul 2005 17:03:08 +0200, Jan Danielsson wrote:
> The problem is that I have initialized the list like this:
>
> self.drawAttr = { blah, blah, blah.. }
> self.storedAttr = [ ]
> for i in range(0, 10):
>self.storedAttr.append(self.drawAttr)
>
>I know what the problem is; they ar
On Sat, 23 Jul 2005 13:50:36 -0400, Mike Meyer wrote:
>> I don't think this is particularly useful behaviour. How do you use it?
>
> def __str__(self):
> return self._format % self
That doesn't work. It calls self.__str__ recursively until Python halts
the process.
>>> class Thing(d
On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote:
> Hi all,
>
> Just having started with python, I feel that simple array operations '*'
> and '+' don't do multiplication/addition but instead extend/join an
> array:
* and + are not array operations, they are list operations.
Lists in
1 - 100 of 110 matches
Mail list logo