Ups, that was meant to go to the pykde list.
Sorry,
Frans
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I've stumbled over a behavior related to default function arguments which
appears to be a bug, from what I can tell. See this snippet:
>>> from kdecore import KURL
>>> u = KURL( "http://www.example.org/test/../"; )
>>> u.cleanPath()
Traceback (most recent call last):
File "", line 1,
This is silly. How do I access data files I've installed with distutils? In a
portable, generic way, I want to find out what is the following path on most
systems:
/usr/local/lib/python2.4/lib/site-packages/foo/bar.txt
How do I figure out the rest, if I know foo/bar.txt? sys.prefix doesn't get
Hello,
I have trouble installing a data directory which is not a child of my package
directory in the source directory.
My source directory looks like this:
./setup.py
schemas/*.xsd
foo/*.py
And when it's installed, it should look like:
site-packages/foo/*.py
site-packages/foo/schemas/*.xsd
On Monday 14 February 2005 00:53, Aahz wrote:
> In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]>
wrote:
> >[EMAIL PROTECTED] (Aahz) writes:
> >> In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]>
wrote:
> >>>Here here. I find that threading typically introduces worse p
Hello,
Have a look at this recursive function:
def walkDirectory( directory, element ):
element = element.newChild( None, "directory", None ) # automatically
appends to parent
element.setProp( "name", os.path.basename(directory))
for root, dirs, files in os.walk( directory ):
That's what PyChecker tells me, at least.
A line of:
if testReport is not None:
results in:
runner.py:587: Using is not None, may not always work
In what circumstances can `is not None` fail? How and why does it fail?
What is the equivalent expression which is more secure; `!= None`?
Chee
On Tuesday 01 February 2005 05:02, Steven Bethard wrote:
> Frans Englich wrote:
> > But in Python, when one wants to be able to pass different data types
> > into a single "entry point" for functionality, how is that best done? To
> > in a function do an if sta
On Tuesday 01 February 2005 05:08, Cameron Laird wrote:
> We learned long ago to treat you, Alex, as an exception.
> While it's rather unpythonic to have implicit rules, let's
> forgive Robert for failing to mention the one that regards
> you as an outlier for inferential purposes.
Excellent timi
Hello,
Since Python doesn't have static typing, how is the same result as traditional
function overloads results in acheived? With function overloads the
"selection of code path depending on data type" is transparent and automatic
since the typing system figure out what goes to what.
But in P
On Wednesday 26 January 2005 21:24, M.E.Farmer wrote:
> Hello Frans,
> What you are seeing is a step on the path to unification of types and
> classes.
I changed all base classes in my project to inherit object. There appears to
be no reason to not do it, AFAICT.
Thanks,
Frans
(Picking up a side track of the "python without OO" thread.)
On Wednesday 26 January 2005 11:01, Neil Benn wrote:
> I say this because you do need to be aware of the
> 'mythical python wand' which will turn you from a bad programmer into a
> good programmer simply by typing 'class Klass(object):
On Wednesday 26 January 2005 18:55, Terry Reedy wrote:
> Your Four Steps to Python Object Oriented Programming - vars, lists, dicts,
> and finally classes is great. It makes this thread worthwhile. I saved it
> and perhaps will use it sometime (with credit to you) to explain same to
> others.
I
On Tuesday 25 January 2005 02:17, Bill Mill wrote:
> read this thread, it should help you:
>
> http://mail.python.org/pipermail/tutor/2005-January/035124.html
Thanks, it did. Not optimally, but in the way I suspected it would be solved.
In short, the solution, when translated to my case, is to in
Hello all,
Due to the size of my source, I want to split it up into multiple
files(basically one class in each file), but then I have difficulties with
the directory layout when the modules are installed with distutils.
This is my file layout:
in ./ I have a setup.py which has 'packages="foo"
On Sunday 23 January 2005 18:04, Michael Hoffman wrote:
> Frans Englich wrote:
[...]
> if command_line_debug_option:
> debug = _debug_true
> else
> debug = _debug_false
I find this a nice solution. The most practical would be if it was possible to
do this with print,
Nah, I don't think it's a function, but rather a builtin "statement". But it's
possible to invoke it as an function; print( "test" ) works fine.
So I wonder, what _is_ exactly the print statement? The untraditional way of
invoking it(without paranteses) makes me wonder.
The reason I thinks abo
On Monday 17 January 2005 21:24, Peter Otten wrote:
> Frans Englich wrote:
> > On Monday 17 January 2005 20:03, John Roth wrote:
> >> "Frans Englich" <[EMAIL PROTECTED]> wrote in message
> >
> >
> >
> >> In other words, you're try
On Monday 17 January 2005 20:03, John Roth wrote:
> "Frans Englich" <[EMAIL PROTECTED]> wrote in message
> In other words, you're trying to create a singleton. In general,
> singletons are frowned on these days for a number of reasons,
> not least because
On Monday 17 January 2005 20:55, Frans Englich wrote:
> On Monday 17 January 2005 19:02, Peter Otten wrote:
> > Frans Englich wrote:
> > > What the code attempts to do is implementing a, to the API user,
> > > transparent memory-saver by ensuring that no more than one
On Monday 17 January 2005 19:02, Peter Otten wrote:
> Frans Englich wrote:
> > What the code attempts to do is implementing a, to the API user,
> > transparent memory-saver by ensuring that no more than one instance of
> > the class foo exists for a particular id. E.g
On Monday 17 January 2005 18:45, Frans Englich wrote:
> The line 'self = me'(scary..) doesn't really
> work for the attribute attr; the attribute exists on line 21, but it fails
> when yo() tries to access it.
Typo; line 21 is yo(). I ment line 18, the print stateme
Hello,
I am having trouble with throwing class instances around. Perhaps I'm
approaching my goals with the wrong solution, but here's nevertheless a
stripped down example which demonstrates my scenario:
#--
On Wednesday 12 January 2005 18:56, [EMAIL PROTECTED] wrote:
> I can not break the original code in 2.4, if I try this:
[...]
>
> So although the dictionary solution is much nicer nothing seems wrong
> with your code as it is - or am I missing something?
Nope, the current code works. I'm just lo
As continuation to a previous thread, "PyChecker messages", I have a question
regarding code refactoring which the following snippet leads to:
> > runner.py:200: Function (detectMimeType) has too many returns (11)
> >
> > The function is simply a long "else-if" clause, branching out to
> > diffe
Hello,
I take PyChecker partly as an recommender of good coding practice, but I
cannot make sense of some of the messages. For example:
runner.py:878: Function (main) has too many lines (201)
What does this mean? Cannot functions be large? Or is it simply an advice that
functions should be sm
Hello,
I have a custom module which among others contains a dictionary, acting as a
"constant". I want to document it, but no matter what I do, it doesn't show
up in `pydoc`. For example, the following doesn't work:
"""
A dictionary of the namespaces.
"""
xmlns = {
...
}
or
xmlns = {
"""
A d
On Friday 17 December 2004 16:40, Amir Dekel wrote:
> This must be the silliest question ever:
>
> What about user input in Python? (like stdin)
> Where can I find it? I can't find any references to it in the
> documentation.
See sys.stdin
Cheers,
Frans
--
http://mail.python.or
On Friday 17 December 2004 15:40, Fredrik Lundh wrote:
> "GMane Python" <[EMAIL PROTECTED]> wrote:
> > I was wondering if there is an existing function that would let me
> > determine the difference in time. To explain:
> >
> > Upon starting a program:
> >
> > startup = time.time()
> >
> > After
On Wednesday 15 December 2004 14:07, Diez B. Roggisch wrote:
> > In my use of getopt.getopt, I would like to make a certain parameter
> > mandatory. I know how to specify such that a parameter must have a value
> > if it's specified, but I also want to make the parameter itself
> > mandatory(combin
On Thursday 16 December 2004 14:46, [EMAIL PROTECTED] wrote:
> > # confDocument is a libxml2 document, from parseFile() etc
> > xp = confDocument.xpathNewContext()
> > xp.xpathRegisterNs("xhtml", "http://www.w3.org/1999/xhtml";)
> > dirElement = xp.xpathEval( "/xhtml:html" )
>
> Stu
On Thursday 16 December 2004 12:29, Maxim Khesin wrote:
> I do not believe it is... You can see the doc by clicking on the link.
> Does it have to be?
No, but your XPath statements must match the namespace, no matter what it is.
The document do have a namespace -- as XHTML should:
http://www.w3
On Wednesday 15 December 2004 20:12, Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Frans Englich
>
> wrote:
> > Hello,
> >
> > In my use of getopt.getopt, I would like to make a certain parameter
> > mandatory.
>
> Isn't a *ma
Hello all,
I have a couple of questions related to module importing.
1) When I start my Python program with `python foo.py` instead of simply
adding a interpreter comment on the first line and do `./foo.py`, some
"local" imports fails, I guess because current working directory is
different. I
On Wednesday 15 December 2004 13:59, Chris wrote:
> > Try WingIDE if you have some money (about 35 E/$ for the personal
> > version) to spend, it's worth every (euro)cent. But please try SPE
> > first, maybe that's enough for you.
>
> SPE?
After googling for "python spe", my guess is "SPE - Stani'
On Wednesday 15 December 2004 13:44, Craig Ringer wrote:
> On Wed, 2004-12-15 at 21:45, Frans Englich wrote:
> > 2) I use Python modules which are not usually installed(libxml2/libxslt)
> > and want to fail gracefully in case the modules aren't available; print
> > an
Hello,
In my use of getopt.getopt, I would like to make a certain parameter
mandatory. I know how to specify such that a parameter must have a value if
it's specified, but I also want to make the parameter itself
mandatory(combined with a mandatory value, the result is that the user must
spec
On Wednesday 15 December 2004 13:33, [EMAIL PROTECTED] wrote:
> Hello.
> Maybe someone will help me with this KeyError:
>
>
> Traceback (most recent call last):
> File "C:\Python\tabla.py", line 929, in -toplevel-
> tablesDirectory = tablesDirectoryPrefix + os.env
38 matches
Mail list logo