On 1 Dec 2005 05:45:54 -0800, "Niels L Ellegaard" <[EMAIL PROTECTED]> wrote:
>I just started learning python and I have been wondering. Is there a
>short pythonic way to find the element, x, of a list, mylist, that
>maximizes an expression f(x).
>
>In other words I am looking for a short version o
Hermy:
> So, for the moment my conclusion is that although Python has some
> syntax for multiple inheritance, it doesn't support it very well, and I should
> probably stick to single inheritance.
This is not much a problem of Python, the problem is that multiple
inheritance is
intrinsically HARD t
"Pat" <[EMAIL PROTECTED]> writes:
> Thomas Heller wrote:
>>
>> What is the difference between PyDispatcher and Louie?
>> (I'm still using a hacked version of the original cookbook recipe...)
>
> Not too much at this point, but the general differences are listed on
> this page:
>
> http://louie.ber
[EMAIL PROTECTED] wrote:
> Thanks. In that case, would it be easier to understand(beside the
> original iterative loop) if I use reduce and lambda ?
>
You could try putting them side by side and seeing which is easiest for
someone to understand:
reduce(lambda (mv,mx), (v,x): mv > v and (mv,mx) o
Mr.Rech wrote:
> Suppose I have a bunch of classes that represent slightly (but
> conceptually) different object. The instances of each class must behave
> in very similar manner, so that I've created a common class ancestor
> (let say A) that define a lot of special method (such as __getattr__,
>
Chris Mellon wrote:
> On 11/30/05, could ildg <[EMAIL PROTECTED]> wrote:
>
>>In java and C# String is immutable, str=str+"some more" will return a new
>>string and leave some gargabe.
>>so in java and C# if there are some frequent string operation,
>>StringBuilder/StringBuffer is recommanded.
>>
>
Alex Martelli wrote:
> Yep -- "time tuples" have also become pseudo-tuples (each element can be
> accessed by name as well as by index) a while ago, and I believe there's
> one more example besides stats and times (but I can't recall which one).
Apart from time and os.stat all the uses seem to be
"Gerald Klix" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Did you consider the mmap library?
> Perhaps it is possible to avoid to hold these big stings in memory.
> BTW: AFAIK it is not possible in 32bit windows for an ordinary programm
> to allocate more than 2 GB. That re
could ildg wrote:
> In java and C# String is immutable, str=str+"some more" will return a
> new string and leave some gargabe.
> so in java and C# if there are some frequent string operation,
> StringBuilder/StringBuffer is recommanded.
>
> Will string operation in python also leave some garbag
Inyeol Lee wrote:
(snip)
class A(object):
... def __init__(self, foo):
... if self.__class__ is A:
... raise TypeError("A is base class.")
s/TypeError/NotImplementedError/
s/base class/abstract class/
--
bruno desthuilliers
python -c "pri
On 2005-12-01, Mike Meyer <[EMAIL PROTECTED]> wrote:
> Antoon Pardon <[EMAIL PROTECTED]> writes:
>> On 2005-12-01, Mike Meyer <[EMAIL PROTECTED]> wrote:
>>> Antoon Pardon <[EMAIL PROTECTED]> writes:
I know what happens, I would like to know, why they made this choice.
One could argue that
Thanks for your suggestions. They are very usefull and indeed bypass my
problem. However, I've found a (perhaps) more elegant way to get the
same result using metaclasses. My idea is to define my classes as
follows:
>>> class meta_A(type):
def __new__(cls, classname, bases, classdict):
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas G. Apostolou wrote:
>
> > I still get the error:
> > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file:
> > 'Python.h': No such file or directory
> > error: command '"C:\Program Files\Microsoft Vi
"Claudio Grondi" <[EMAIL PROTECTED]> wrote:
> but the problem with sets.c remains:
>
> C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX
> /DNDEBUG -IE:\Python24\include -IE:\Python24\PC /Tcsrc/sets/sets.c
> /Fobuild\temp.win32-2.4\Re
> lease\src/sets/sets.obj
> sets.c
> src\sets\s
Mr.Rech wrote:
> Thanks for your suggestions. They are very usefull and indeed bypass my
> problem. However, I've found a (perhaps) more elegant way to get the
> same result using metaclasses. My idea is to define my classes as
> follows:
>
class meta_A(type):
> def __new__(cls, cl
"Sverker Nilsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> "Claudio Grondi" <[EMAIL PROTECTED]> wrote:
>
> > but the problem with sets.c remains:
> >
> > C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX
> > /DNDEBUG -IE:\Python24\include -IE:\Python24\PC
Mardy wrote:
> Hi all,
> I'm starting to think the way I've implemented my program
> (http://www.mardy.it/eligante) is all wrong.
> Basically, what I want is a web application, which might run as CGI
> scripts in apache (and this is working) or even as a standalone
> application, in which case it
Mr.Rech wrote:
> Thanks for your suggestions. They are very usefull and indeed bypass my
> problem. However, I've found a (perhaps) more elegant way to get the
> same result using metaclasses.
(snip code)
>
> I know metaclasses are a complete different beast, anyway I find this
> approach more
I'm new to python. Have a simple question.
"open" function can only open an existing file and raise a IOerror when
the given file does not exist. How can I creat a new file then?
--
http://mail.python.org/mailman/listinfo/python-list
Howdy all,
My practice when writing unit tests for a project is to make 'test/'
subdirectories for each directory containing modules I want to test.
project-foo/
+-- lib/
| +-- test/
+-- data/
+-- gui/
| +-- test/
+-- server/
+-- test/
This means that I ne
Thomas G. Apostolou wrote:
> So what you say is that the Python installed with Plone doesn't have
> Python.h in ./include but Python installers from Python.org do have the
> file?
that's likely, given building didn't work for you.
after all, Plone's an application that happens to include a Pytho
[EMAIL PROTECTED] wrote:
> DecInt's division algorithm is completely general also. But I would
> never claim that Python code is faster than assembler. I believe that
> careful implementation of a good algorithm is more important than the
> raw speed of the language or efficiency of the compiler.
sandorf wrote:
> I'm new to python. Have a simple question.
>
> "open" function can only open an existing file and raise a IOerror when
> the given file does not exist. How can I creat a new file then?
fic = open('test.txt', 'w')
fic.write('Hello world')
fic.close()
--
http://mail.python.org/
sandorf wrote:
> I'm new to python. Have a simple question.
>
> "open" function can only open an existing file and raise a IOerror when
> the given file does not exist. How can I creat a new file then?
>
open the new file in write mode: open('foo', 'w')
See: help(open)
HTH,
Wolfram
--
http://ma
sandorf wrote:
> I'm new to python. Have a simple question.
>
> "open" function can only open an existing file and raise a IOerror when
> the given file does not exist. How can I creat a new file then?
>
You already have two correct answers. A warning: if you open a existing
file for writing, it
"sandorf" <[EMAIL PROTECTED]> wrote:
> I'm new to python. Have a simple question.
>
> "open" function can only open an existing file and raise a IOerror when
> the given file does not exist. How can I creat a new file then?
reading the documentation might help:
>>> help(open)
class file(object)
On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote:
> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>
>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote:
>>> Antoon Pardon wrote:
>>>
> The left one is equivalent to:
>
> __anon = []
> def Foo(l):
>
Steven Bethard wrote:
>>> I feel like there should be a simpler solution (maybe with the re
>>> module?) but I can't figure one out. Any suggestions?
>>
>> using the finditer pattern I just posted in another thread:
>>
>> tokens = ['She', "'s", 'gon', 'na', 'write', 'a', 'book', '?']
>> text = ''
Le die Thu, 01 Dec 2005 15:08:14 -0800, amfr ha scribite:
> I have included some of the content of that file, I am writing this as
> an extension to my ebserver which is based on BaseHTTPServer. This
> part of the code was taken directly from the CGIHTTPServer file,
> nothing changed
I did the s
Ben Finney wrote:
> This works, so long as the foomodule is *not* in the path before the
> appended '..' directory. When writing unit tests for a development
> version of a package that is already installed at an older version in
> the Python path, this fails: the unit tests are not importing the
Many Python scripts I see start with the shebang line
#!/usr/bin/env python
What is the difference from using just
#!python
Regards,
Adriano.
--
http://mail.python.org/mailman/listinfo/python-list
I'd be interested in seeing the one liner using reduce you mentioned --
how it might be done that way isn't obvious to me.
Another aspect of Taschuk's solution I like and think is important is
the fact that it is truly iterative in the sense that calling it
returns a generator which will yield eac
Thank to you all, guys. Here's another question:
I'm using the Windows version of Python and IDLE. When I debug my .py
file, my modification to the .py file does not seem to take effect
unless I restart IDLE. Saving the file and re-importing it doesn't help
either. Where's the problem?
--
http:/
Adriano Ferreira wrote:
> Many Python scripts I see start with the shebang line
>
> #!/usr/bin/env python
>
> What is the difference from using just
>
> #!python
#v+
$ ls -l /tmp/hello.py
-rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py
$ cat /tmp/hello.py
#! python
print 'Hello, worl
Hello Bengt,
Bengt Richter wrote:
> On 1 Dec 2005 03:38:37 -0800, "Fuzzyman" <[EMAIL PROTECTED]> wrote:
>
> >
> >Fuzzyman wrote:
> >> Sorry for this hurried message - I've done a new implementation of out
> >> ordered dict. This comes out of the discussion on this newsgroup (see
> >> blog entry fo
On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote:
> #v+
>
> $ ls -l /tmp/hello.py
> -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py
> $ cat /tmp/hello.py
> #! python
> print 'Hello, world!'
> # eof
> $ /tmp/hello.py
> bash: /tmp/hello.py: python: bad interpreter: No such f
Adriano Ferreira wrote:
> Many Python scripts I see start with the shebang line
>
> #!/usr/bin/env python
>
> What is the difference from using just
>
> #!python
$ more test.py
#!python
print "hello"
$ chmod +x test.py
$ ./test.py
-bash: ./test.py: python: bad interpreter: No such file or directo
Quoting Andrew Kuchling:
"""
> >>> element = document.createElementNS("DAV:", "href")
This call is incorrect; the signature is createElementNS(namespaceURI,
qualifiedName).
"""
Not at all, Andrew. "href" is a valid qname, as is "foo:href". The
prefix is optional in a QName. Here is the
I'm using the Windows version of Python and IDLE. When I debug my .py
file, my modification to the .py file does not seem to take effect
unless I restart IDLE. Saving the file and re-importing it doesn't help
either. Where's the problem?
Thanks.
--
http://mail.python.org/mailman/listinfo/pytho
Adriano Ferreira skrev:
>> #v+
>>
>> $ ls -l /tmp/hello.py
>> -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py
>> $ cat /tmp/hello.py
>> #! python
>> print 'Hello, world!'
>> # eof
>> $ /tmp/hello.py
>> bash: /tmp/hello.py: python: bad interpreter: No such file or directory
>> $
>>
>> #
I see your point. Looking again at my metaclass implementation and
comparing it with your abstract class + inheritance approach it turns
out that the latter is definetively more straightforward, easier to
maintain and all in all more pythonic.
Sorry, but being an OOP newbie put me in the position
On Fri, 2005-12-02 at 09:12, Adriano Ferreira wrote:
> On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote:
> > #v+
> >
> > $ ls -l /tmp/hello.py
> > -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py
> > $ cat /tmp/hello.py
> > #! python
> > print 'Hello, world!'
> > # eof
> >
I'm a big fan of Eclipse and reocmmend it to anyone who asks :)
No one can say any one is the *best*, since it's a matter of taste,
but it's pretty darn good.
The main benefit IMO is it's felibility ... Eclipse is a *framework*,
that can handle lots things quite well, like HTML (If you're coding
sandorf wrote:
>I'm using the Windows version of Python and IDLE. When I debug my .py
>file, my modification to the .py file does not seem to take effect
>unless I restart IDLE. Saving the file and re-importing it doesn't help
>
>either. Where's the problem?
>
>Thanks.
>
>
>
No problem. Just r
I have a Makefile target that uses a python script, like:
%.abc: %.def
python myscript.py
The problem is that myscript.py and some modules that myscript.py
imports are not in the current directory, but in another place in the
filesystem, say, /path/to/stuff. If this was a tcsh script, I w
Hi Chris,
I think that you should try it yourself... being the *best ide* is
usually a subjective matter, so, you should decide yourself if it is the
best IDE for the task you want it to.
I must also warn you that I'm its current maintainer, and it is *my*
favorite IDE :-)
Also, I use it for
Martin Miller wrote:
> I'd be interested in seeing the one liner using reduce you mentioned --
> how it might be done that way isn't obvious to me.
>
> Another aspect of Taschuk's solution I like and think is important is
> the fact that it is truly iterative in the sense that calling it
> returns
[EMAIL PROTECTED] wrote:
> Could the above server-speed assymetry that i spoke of above be caused
> by this reverse dns lookup?
I think so. You stated that you use "a fairly simple HTTP server",
although that's not exactly specific enough to diagnose the problem,
but if that were the standard libr
On 12/2/05, Carsten Haese <[EMAIL PROTECTED]> wrote:
> (3) assumes that whatever shell the user is running looks up the shebang
> executable in the path, which bash, just to name one example, does not
> do.
I think that was the answer I was looking for. So that "#!/usr/bin/env
python" is more port
Adriano Ferreira wrote:
> So that "#!/usr/bin/env python" is more portable than "#! python"
> and that's probably why it worked for me with cygwin/bash but not
> for Klaus on whatever platform he used.
/me is using bash on linux.
> I agree. Only a very strange Unix-like installation would not
Adrian Holovaty wrote:
> http://code.djangoproject.com/wiki/DevelopersForHire
>
> See the "Django-powered jobs" section. We could definitely advertise
> this page more, as it's a bit hidden at the moment on the Django wiki.
Don't forget the Python Job Board:
http://www.python.org/Jobs.html
Yes,
<[EMAIL PROTECTED]> wrote:
...
> As while DSU is a very smart way to guard the max compare thing, it is
> still being introduced as a way that is not related to the original
> problem, i.e. I just want to compare f(x)
And that's why in 2.5 you'll just code max(mylist, key=f) to express
this int
On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote:
> /me is using bash on linux.
I think that was not a bash issue in my case, but a Cygwin/Win32
issue. Windows has some monstruous oddities in order to assure broken
behavior of yesterday is here today in the name of compatibility.
Exa
I am a newcomer to using Python and Qt and the main problem that I have
is the dearth of any example code or books describing the use of Python
and Qt together.
My current problem is that I want to create a custom cursor, from my
understanding of it I need to create two "QBitmap"s, one of which wi
Fredrik Lundh wrote:
> Steven Bethard wrote:
>
>
I feel like there should be a simpler solution (maybe with the re
module?) but I can't figure one out. Any suggestions?
>>>
>>>using the finditer pattern I just posted in another thread:
>>>
>>>tokens = ['She', "'s", 'gon', 'na', 'write',
Michael Spencer wrote:
> Steven Bethard wrote:
>
>> I've got a list of word substrings (the "tokens") which I need to
>> align to a string of text (the "sentence"). The sentence is basically
>> the concatenation of the token list, with spaces sometimes inserted
>> beetween tokens. I need to d
Is it possible to to detect a Tkinter top-level window being closed with the
close icon/button (top right), for example to call a function before the
window actually closes?
Python 2.4 / Linux (2.6 kernel) if that makes any difference.
Any info would be greatly appreciated.
Thanks
Glen
--
http://
On Friday 02 December 2005 3:31 pm, [EMAIL PROTECTED] wrote:
> I am a newcomer to using Python and Qt and the main problem that I have
> is the dearth of any example code or books describing the use of Python
> and Qt together.
>
> My current problem is that I want to create a custom cursor, from m
Glen wrote:
> Is it possible to to detect a Tkinter top-level window being closed with the
> close icon/button (top right), for example to call a function before the
> window actually closes?
>
> Python 2.4 / Linux (2.6 kernel) if that makes any difference.
> Any info would be greatly appreciated.
[EMAIL PROTECTED] wrote:
>I'm trying to move beyond Emacs/Vim/Kate
>and was wondering if Eclipse is better and if it is the *best*
>IDE for Python.
>
>Should I leave Emacs and do Python coding in Eclipse?
>
>
I've been a heavy Emacs user for several years, but recently switched to
Eclipse for P
Glen wrote:
> Is it possible to to detect a Tkinter top-level window being closed with the
> close icon/button (top right), for example to call a function before the
> window actually closes?
http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols
--
http://mail.python.org/
Steven Bethard wrote:
> Michael Spencer wrote:
>
>> Steven Bethard wrote:
>>
>>> I've got a list of word substrings (the "tokens") which I need to
>>> align to a string of text (the "sentence"). The sentence is
>>> basically the concatenation of the token list, with spaces sometimes
>>> insert
Fredrik Lundh wrote:
> Harald Karner wrote:
>>>python -c "print len('m' * ((2048*1024*1024)-1))"
>>
>>2147483647
>
>
> the string type uses the ob_size field to hold the string length, and
> ob_size is an integer:
>
> $ more Include/object.h
> ...
> int ob_size; /* Number of items in va
> I'm using the Windows version of Python and IDLE. When I debug my .py
> file, my modification to the .py file does not seem to take effect
> unless I restart IDLE. Saving the file and re-importing it doesn't help
> either. Where's the problem?
"import" only reads the file the first time it's cal
infidel a écrit :
>>I'm using the Windows version of Python and IDLE. When I debug my .py
>>file, my modification to the .py file does not seem to take effect
>>unless I restart IDLE. Saving the file and re-importing it doesn't help
>>either. Where's the problem?
>
>
> "import" only reads the fil
QOTW: "Python makes it easy to implement algorithms." - casevh
"Most of the discussion of immutables here seems to be caused by
newcomers wanting to copy an idiom from another language which doesn't
have immutable variables. Their real problem is usually with binding,
not immutability." - Mike Me
Thanks Fredrik and Adonis that's just what I needed, plus a bit more to
learn about.
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon <[EMAIL PROTECTED]> writes:
>>> Well there are two possibilities I can think of:
>>>
>>> 1)
>>> arg_default = ...
>>> def f(arg = arg_default):
>>> ...
>>
>> Yuch. Mostly because it doesn't work:
>>
>> arg_default = ...
>> def f(arg = arg_default):
>> ...
>>
>> arg_default =
In article <[EMAIL PROTECTED]>,
Adriano Ferreira <[EMAIL PROTECTED]> wrote:
> Hey, that's not fair. In your illustration above, does 'python' can be
> found in the PATH? That is,
>
> $ python /tmp/hello.py
>
> works? If it does, probably
>
> #!/usr/bin/python
> #!/usr/bin/env python
> #!python
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas G. Apostolou wrote:
>
> > So what you say is that the Python installed with Plone doesn't have
> > Python.h in ./include but Python installers from Python.org do have the
> > file?
>
> that's likely, given buildin
[EMAIL PROTECTED] wrote:
> I'm trying to move beyond Emacs/Vim/Kate
> and was wondering if Eclipse is better and if it is the *best*
> IDE for Python.
>
> Should I leave Emacs and do Python coding in Eclipse?
>
> Chris
I'm agnostic; lots of IDE's/editors have buzz, you should learn to use
at leas
I'm trying to iterate through repeating elements to extract data using
libxml2 but I'm having zero luck - any help would be appreciated.
My XML source is similar to the following - I'm trying to extract the
line number and product code from the repeating line elements:
123456
Hello again everyone,
First, I want to thank all those who have contributed to the
unravelling of this server-slow-down mystery.
But unfortunately, either:
1) i have not made my point clear about what my question is
2) i do not understand the responses given
So, let me briefly reiterate what the
Antoon Pardon <[EMAIL PROTECTED]> writes:
> On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote:
>> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote:
Antoon Pardon wrote:
>>>I think one could argue that since '[]'
[EMAIL PROTECTED]
> I have a Makefile target that uses a python script, like:
> %.abc: %.def
> python myscript.py
> If this was a tcsh script, I would just do:
>setenv PYTHONPATH /path/to/stuff
>python myscript.py
> but this cannot be done from a Makefile.
Use:
%.abc:
How can I tell Pydoc not to list information for some of the base
classes? For example, when a class inherits from gtk.Widget, lots of
GTK stuff gets added that doesn't really need to be there. Is there
some option to Pydoc to tell it to skip some classes? Is there
something I can put in my
Here it is again... Python bypassed/discounted because, of all things,
scoping by indentation!?!?
This used to surprise me. Until I hear more and more otherwise
reasonable programmers list this as their number one reason for
shunning Python.
I gauge design defects by how much after market
discu
[EMAIL PROTECTED] wrote:
> Here it is again... Python bypassed/discounted because, of all things,
> scoping by indentation!?!?
[...]
> Could the PyPy people find some way (I don't how) to eliminate this
> stumbling block going forward??
No: I believe they could only eliminate it "going backward
sandorf wrote:
> Thank to you all, guys. Here's another question:
>
> I'm using the Windows version of Python and IDLE. When I debug my .py
> file, my modification to the .py file does not seem to take effect
> unless I restart IDLE. Saving the file and re-importing it doesn't help
> either. Where
[EMAIL PROTECTED] wrote:
> I'm trying to iterate through repeating elements to extract data using
> libxml2 but I'm having zero luck - any help would be appreciated.
Here's how I attempt to solve the problem using libxml2dom [1] (and I
imagine others will suggest their own favourite modules, too):
On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED]
wrote:
>Here it is again... Python bypassed/discounted because, of all things,
>scoping by indentation!?!?
>
>This used to surprise me. Until I hear more and more otherwise
>reasonable programmers list this as their number one r
Hi guys,
I'm thinking it will take a real expert to do this, probably someone
who can use windows API's or directly poll the hardware or some such
thing. But if you think you know how then please let me
know. I'm trying to write an automation script that will burn an
ISO file each night.
By the
[EMAIL PROTECTED] wrote:
> The server runs fast when one computer is the server, but slow when the
> other computer is the server.
> How can this be, given that this asymmetry does not exist when both
> computers are wired.
Probably because the way your wireless interfaces are configured may be
di
You're not alone.
The first thing I do after installing an IDE or programmers editor is
to change the configuration to use spaces as identantion.
I still don't get why there is still people using real tabs as
indentation.
--
Paulo
Dave Hansen wrote:
> On 2 Dec 2005 10:08:21 -0800 in comp.lang.py
On Fri, Dec 02, 2005 at 10:43:56AM +0100, bruno at modulix wrote:
> Inyeol Lee wrote:
> (snip)
>
> class A(object):
> ... def __init__(self, foo):
> ... if self.__class__ is A:
> ... raise TypeError("A is base class.")
>
>
> s/TypeError/NotI
In article <[EMAIL PROTECTED]>,
Dave Hansen <[EMAIL PROTECTED]> wrote:
> On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED]
> wrote:
>
> >Here it is again... Python bypassed/discounted because, of all things,
> >scoping by indentation!?!?
> >
> >This used to surprise me. Until
Any help would be great on this. I've been trying to bind a
username and password to the ldap server for authentication, but when I
locally run this script:
#!/usr/bin/python
import ldap
## Connect to LDAP host
try:
ldapcn = ldap.initialize('ldap://xxx.xxx.xxx.xxx')
ldapcn.bind('cn=usern
On 2 Dec 2005 13:05:43 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote:
>> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>>
>>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote:
Antoon Pardon wrote:
>
>Perso
Dear list,
The syntax for using assertRaise is
assertRaise(exception, function, para1, para2,...)
However, I have a long list of arguments (>20) so I would like to test
some of them using keyword arguments (use default for others). Is there
a way to do this except for manually try...except?
I have been looking a bit and am stuck at this point.
Given a string, how do i find what is the string bound to.
Let me give an example.
def deep():
print "Hello"
now inspect.ismethod(deep) returns true. (As it should).
But if I am trying to make a list of all bound methods), i use
dir(), w
On 2 Dec 2005 06:16:29 -0800,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Of course. Minidom implements level 2 (thus the "NS" at the end of the
> method name), which means that its APIs should all be namespace aware.
> The bug is that writexml() and thus toxml() are not so.
Hm, OK.
Bo Peng wrote:
> The syntax for using assertRaise is
>
>assertRaise(exception, function, para1, para2,...)
>
> However, I have a long list of arguments (>20) so I would like to test
> some of them using keyword arguments (use default for others). Is there
> a way to do this except for manually
>From python, I need to be able to create CSG objects and calculate their volume
(and from that their mass).
It looks like their are plenty of packages to create and display CSG objects,
however, I can not seem to find any API to get to the object's volume.
If anyone has any ideas/tips/pointers/e
I am using execfile, setting stdin and stdout like this:
sys.stdin = self.wfile
sys.stdout = self.rfile
execfile(filename)
Its the same code used in the CGIHTTPServer module. I know that the
python is executing corretly, a script with this content would work:
print ""
print ""
print ""
print "bl
On Dec 02, Dave Hansen wrote:
> Python recognizes the TAB character as valid indentation. TAB
> characters are evil. They should be banned from Python source code.
AGREE! AGREE! AGREE!
> The interpreter should stop translation of code and throw an
> exception when one is encountered.
You co
Giovanni Bajo wrote:
> You can pass keyword arguments to assertRaises without problems:
>
> self.assertRaises(ValueError, myfunc, arg1,arg2, arg3, arg4, abc=0, foo=1,
> bar="hello")
Well, I though abc=0 would be keyword arguments for assertRaisers and
never tried it!
>
> Or you can always do s
Deep wrote:
> I have been looking a bit and am stuck at this point.
>
> Given a string, how do i find what is the string bound to.
> Let me give an example.
>
> def deep():
> print "Hello"
>
> now inspect.ismethod(deep) returns true. (As it should).
> But if I am trying to make a list of al
Deep wrote:
> I have been looking a bit and am stuck at this point.
>
> Given a string, how do i find what is the string bound to.
> Let me give an example.
>
> def deep():
> print "Hello"
>
> now inspect.ismethod(deep) returns true. (As it should).
> But if I am trying to make a list of al
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Micah Elliott wrote:
> On Dec 02, Dave Hansen wrote:
>
>>Python recognizes the TAB character as valid indentation. TAB
>>characters are evil. They should be banned from Python source code.
>
> AGREE! AGREE! AGREE!
>
>>The interpreter should sto
On 12/2/05, Dave Hansen <[EMAIL PROTECTED]> wrote:
> FWIW, indentation scoping one one of the features that _attracted_ me
> to Python.
+1 QOTW
OK, it's a bit of a cliche. But it's a cliche because it's *true*.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
1 - 100 of 133 matches
Mail list logo