d access at all levels of code (unless req is a global
variable?).
Do you have any other suggestions as to how this might be implemented?
Many thanks,
Andrew
Hi all,
I'm writing an application which runs within Apache and uses mod_python
to provide basic authentication and return content to the u
On 6/18/05, D H <[EMAIL PROTECTED]> wrote:
> I would hardly call using a
> dictionary as a switch statement, the "equivalent". The fact that
> people use a dictionary as a conditional is a python wart.
Not at all. A case statement is nothing more than a literal mapping of
constant values to the e
ss to use.
You can use reflection to dynamically create the Command instances or
the name can be used by a factory as an id.
The Commands themselves know what they are supposed to do, not the
Script parsing engine.
The second approach is using FIT/Fitnesse - google these for exact
descripti
I'm investigating getting Microsoft Navision to do stuff from a Python
script. The recommended way seems to be to use message queues (MSMQ).
I can get Navision to send a message to itself fine. I found a couple
of code example in an ancient message in this newsgroup. The send.py
one I change
On 6/29/05, Rocco Moretti <[EMAIL PROTECTED]> wrote:
>
> Sorry, thought of one more thing Python has going for it vs. Forth -
> reference material. Check the catalog of your local library. I'd guess
> that there is more choice for Python programming books vs. Forth
> programming books.
I just che
recent call last):
File "", line 1, in ?
TypeError: list indices must be integers
Corrected version:
result = [(lambda: expr0), lambda: expr1][bool(cond)]()
Or if using python < 2.3:
result = [(lambda: expr0), lambda:
expr1][__import__("operator").truth(cond)](
On 30 Jun 2005 14:38:17 -0700, MooMaster <[EMAIL PROTECTED]> wrote:
> So I started reading about os, threads,
> and the path for the special folders in the archives and in the Python
> docs and I'm kind of lost because there aren't many concrete examples
> in the documentation. Can anyone point me
On 7/1/05, Chinook <[EMAIL PROTECTED]> wrote:
> Thank you Andrew, and your elaboration is well taken. I was just
> exploring here and the construct you noted is IMHO intuitively readable
> - at least for a simple expression and condition. Other than the
> choice order [
some wierd property requiring conservation of
> consonants, when speaking Strine you've got to take the r's
> removed from words like "carrier" and "order", and add them to
> the ends of other words like Amanda.
No, you've got it wrong -- we take them and i
"Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>class grouping:
>
>def __init__(self, .x, .y, .z):
># real code right here
> Emulation using existing syntax::
>def __init__(self, x, y, z):
>self.x = x
>
On 6 Jul 2005 00:30:34 -0700, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>
> With Lisp or Forth, a master programmer has unlimited power and
> expressiveness. With Python, even a regular guy can reach for the
> stars.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
Title: Python Windows Install Problem (Error #2755)
Please find attached a PDF file (removed due to size) containing (2) print-screen images of an error (Code # 2755) occuring during attempted installation of python for windows, version 2.4.1 (on PC using MS2000). Any help would be a
ing
something to do with the marshalling of floats (.pyc files contain
constants in a marshalled form). Don't think I've ever seen it myself...
-----
Andrew I MacIntyre "These thoughts are mi
"rbt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the appropriate way to break out of this while loop if the for
> loop finds a match?
Make it a function and use a "return" statement to break out.
--
http://mail.python.org/mailman/listinfo/python-list
On 7/13/05, Jorey Bump <[EMAIL PROTECTED]> wrote:
> >>> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> >>>
> >>> The larch!
>
> IT'S A TREE
... not a shrubbery?
--
http://mail.python.org/mailman/listinfo/python-list
pe(file) is types.StringType:
self.file = open(file, 'r')
(hmm, that last one looks buggy. It should
have a "else: self.file = file" afterwards.)
Used in the std. lib and used by many different
people. (I excluded the Biopython libraries
in this list, btw, because I may have influenced
the use of this sort of type check.)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
emphasis of class
hierarchies.
I think the same is true here. File paths and URIs are
sufficiently different that there are only a few bits
of commonality between them. Consider 'split' which
for files creates (dirname, filename) while for urls
it creates (scheme, netloc, path, query, fragment)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
API
is one that requires less knowledge. I haven't
seen an example of how deriving from (unicode)
string makes things more complicated than not doing so.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
an 'single quoted quotes'.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
.readlines = self.fp.readlines
if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno
if hasattr(self.fp, "__iter__"):
self.__iter__ = self.fp.__iter__
if hasattr(self.fp, "next"):
self.next = self.fp.next
It looks like the fp for your latter code
doesn't have the additional properties. Try
adding the following debug code to figure out
what's up
print dir(ifs)
print "fp=", ifs.fp
print "dir(fp)", dir(ifs.fp)
Odds are you'll get different results.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
teed "no more than a line at a time"
semantics, try this
for line in iter(stdout.readline, ""):
print "LINE:", line
sys.stdout.flush()
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
tation of the latter is
trivial - put a @property on the line before the "def dirname(self):".
I think that the string representation of a path is so important that
it *is* the path. The other things you call properties aren't quite
properties in my model of a path and are more like computable values.
I trust my intuition on this, I just don't know how to justify it, or
correct it if I'm wrong.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
d a "get the filename"
interface then perhaps it wouldn't make a difference. Which means
I'm also more guided by practical reasons than conceptual.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
any Vikings.
>>>
I've found though that the double-leading-underscore is overkill.
Using a single underscore is enough of a hint that the given
method shouldn't be called directly.
Then again, I don't write enough deep hierarchies where I need
:
- a path can't be compared to "-"
- range isn't supported, as "name = name[1:]"
note that this example uses __contains__ ("," in name)
Is this function brain-dead? Is it reasonable that people might
want to pass a path.Path() directly to it? If not, what's
the way to convert the path.Path() into the correct string
object?
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
> Reinhold Birkenfeld wrote:
>> Current change:
>>
>> * Add base() method for converting to str/unicode.
Now that [:] slicing works, and returns a string,
another way to convert from path.Path to str/unicode
is path[:]
e,
BerkeleyDB, etc.) to maintain your system state and let the
library handle transactions for you.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
en(y))
in length - the result has length len(x).
As others suggested, if you want to use map, go ahead. It won't
disappear for a long time and even if it does it's easy to
retrofit if needed.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ement in term:
if element is not sentinel:
break
else:
# All sentinels
break
yield [replace(element, element) for element in term]
(I originally had a "element == tuple([sentinel]*len(seqs))" check
but didn't like all the == tests incurred.)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hmm, it should probably yield tuple(fields)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
is is code best not widely used, I don't think it's something
anyone should look into either. :)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
s/man2/_exit.2.html
and note the statement "can never return".
sys.exit() is identical to "raise SystemExit()". It raises a Python
exception which may be caught at a higher level in the program stack.
Andrew
[E
n izip(*[chain(seq, done_iter()) for seq in seqs])
Now add the performance tweak
def done_iter(done=[len(seqs)], forever=forever, table=table)
Okay, I'm over it. :)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
chain(seq[-1],
> [])]
It does work - I tested it. The trick is that izip takes iter()
of the terms passed into it. iter([]) -> an empty iterator and
iter(repeat(None)) -> the repeat(None) itself.
'Course then the name should be changed.
Andrew
Scott David Daniels wrote:
> Can I play too? How about:
Sweet!
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> Seems my description didn't convince you. So here's an example:
Got it. In my test case the longest element happened to be the last
one, which is why it didn't catch the problem.
Thanks.
Andrew
e of automated testing techniques and thereby improve
> the quality of Python software, including in the standard library.
But then what does the constructor for the file object take?
I've also heard mention that a future (Py3K era) 'open' may allow
URLs and not just
ot; % (len(detail), detail)
You could wrap this up into a class which returns (header, detail) pairs
and does better error handling, but the above code should illustrate the
basics.
--
Andrew McLean
--
http://mail.python.org/mailman/listinfo/python-list
ines, the first line being a header containing
field names specific to that record with the second line containing the
corresponding data.
It would help of you let us know which (if any) was correct.
--
Andrew McLean
--
http://mail.python.org/mailman/listinfo/python-list
g like that.
-----
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370
[EMAIL PROTECTED] (alt) |Belconnen ACT 2616
Web:h
OVERVIEW
Albatross is a small toolkit for developing highly stateful web
applications.
The toolkit has been designed to take a lot of the pain out of
constructing intranet applications although you can also use Albatross
for deploying publicly accessed web applications.
In slightly more than 450
amusing! :-)
It does raise the question though. Is it mundane sex,
..or riveting email, that causes this phenomenon?;-)
[ F'Ups set to c.l.j.p. only ]
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"You live with apes, man, it's
In the C API Docs, the signature of PyBool from long seems to be incorrect.
int PyBool_FromLong(long v)
Returns Py_True or Py_False depending on the truth value of v. New in
version 2.3.
The description would suggest:
PyObject* PyBool_FromLong(long v)
--
http://mail.python.org/mailman/li
an't figure out which module I need to import to access it.
Look at the "os" module.
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
--
http://mail.python.org/mailman/listinfo/python-list
Hi Everyone,
Has anyone done any Python coding to manage/interact/customize BMC Patrol?
If anyone has, could you please point me to where I can find
documentation/guides on this?
I checked the Python SIGs and Vault of Parnasus but didn't see anything
available.
Any insight you might have on thi
fault). You also might be able to use the InfoZip DLL
directly from VBA to package everything (after you've figured out what
needs to be packaged).
-----
Andrew I MacIntyre "These thoughts are mine
.
Regardless, I thank you for what you have released!
Cheers,
Andrew.
-----
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370
>
> 3) The hardest thing to 'understand' is the line...
> self.hiScores=[(entry[:5],entry[5:]) for entry in hiScores]
>
> I 'understand' what it's doing, but I don't quite comprehend what the :5
> and 5: do. I know that the :5 is technically saying from the start to
> position 5, and likewise the 5: would say from position 5 onwards, but I
> just can't get my head around how this works.
See my explanation of __init__().
Does that help?
Andrew
--
http://mail.python.org/mailman/listinfo/python-list
of stack frames for generated
calls has increased. If lowering the optimisation to -O or -Os when
building Python improves the situation, I'd suggest pursuing this
possibility further.
-----
Andrew I MacIntyre
without threads it works).
There is old wisdom that signals and threads should not be mixed, as the
behaviour is not well defined across platforms.
-----
Andrew I MacIntyre "These thoughts are mine alone..."
I'm looking for an implementation of AES (the Advanced Encryption
Standard) in pure Python. I'm aware of pycrypto, but that uses C code.
I'm hoping to find something that only uses Python...I'm willing to
trade speed for portability, since my application is designed for
several different platform
;t do the registry hooks that Skip does, and I see
I need to learn more about the functions in the codes module.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
"markscottwright" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Just for the hell of it, I've been going through the old Scheme-based
> textbook "Structure and Interpretation of Computer Programs" and seeing
> what I can and can't do with python. I'm trying to create a function
>
my resume, that I know python, with
> out bad karma.
>
> Danny
--
Andrew Thomson <[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
and press the key: ")
for temp in range(51, 81):
print "Raising reactor temperature to", temp
temp_controller.target = temp
time.sleep(60)
if abs(temp_controller.current - temp) > 0.1:
print "Variance too high!", temp_controller.current
print "DONE!&
ived* to prove the O() difference.
BTW, Python almost never worries about worst-case behavior, and people
using Python dicts instead of, e.g., balanced trees, get to carry their
shame home with them hours earlier each day .
Andrew
uses a dispatch table to get the underlying C function
which is "dt_getcharge"
return dt_getcharge(self.handle)
where "handle" is the handle used by the C library.
I figured though that this example might be more esoteric
than my PID controller example, though in retrospect it
looks like it might be a better justification.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
_(pluginName)
plugin.someMethod(state)
was useful because it gave the plugin a way to modify
the program state, rather than changing global variables.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
(like
http://thproxy.jinr.ru/file-archive/doc/ftp/ftpsites.lst
), a good memory and lots of free time.
Usenet archives.
Word of mouth.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
terwove
two loops and couldn't be easily untangled.
Since I just wanted to text it out I used C++ which had
both gotos and priority queues built in.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
e in the
> forward direction, to code appearing later.
I only found two google hits, both in a Fortran newsgroup. Other
posts by you suggest you often program in that language. Fortran
doesn't have exceptions, so gotos are the best solution for how
to do certain types of error handlin
"Xah Lee" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> globe=0;
> def myFun():
> globe=globe+1
> return globe
>
> apparently it can't be done like that. I thought it can probably be
> done by prefixing the variable with some package context...
You can do this:
globe=0
worked at it I think I could come up with an example
that wouldn't be so easy to turn into an iterator, but that would
be not only be beating it into the ground but doing a clog dance
on top.
Andrew
[EMAIL PROTECTED]
--
http://mail
you can, I'd suggest posting a bug report on SF against 2.4 to see
whether you can encourage the installer builder to upgrade BSD DB -
though do be certain to check what's in 2.4.1c1 first.
-----
Andrew I MacIntyre
was the only real option.
The key question from my point of view is: can I write commercial
sell-if-I-want-to applications using Qt? If it is GPL, then I guess the
answer is 'no'?
Andrew
--
http://mail.python.org/mailman/listinfo/python-list
This reply is off topic but I couldn't resist:
The best way to get rid of thread is to adopt a kitten.
In fact, one of my cats is named Snobol because she is such a good string
manipulator.
--
http://mail.python.org/mailman/listinfo/python-list
xcept ValueError:
> pass
> #
>
> so the tp_getattr slot isn't being used.
Referring to the original C code you posted, PyObject_HasAttrString() will
call the tp_getattr routine, clearing any exceptions raised as it returns.
--
ty to return x,y
co-ordinates for a shape, as I want to draw an imagemap on top of parts
of the shape.
Can PIL do this, or do I need to go the way of GnuPlot or Gri? Can
anyone give me an example of a complex shape drawn like this?
Many thanks,
Andrew
--
http://mail.python.org/mailman/listinfo/p
ing a small island off the coast of Florida to kill all the
insects then watch how they are reintroduced.
Geology, unless you count the material science work used to
understand how minerals change under pressure and heat, or
including mining as part of geology.
A
n-specific advanced features I can use (things like closures,
lambda forms, map(), etc. etc.). Could anyone point me towards some good
resources?
I would much appreciate some assistance in finding some answers to these
questions, as the research I've done seems to be inconclusive, if not
downr
, its attributes
still get created.
Regards,
Andrew
--
http://mail.python.org/mailman/listinfo/python-list
"Aahz" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> APL. I've heard programmers making similar comments (including possibly
> Michael's nameless acquaintance).
Especially programmers who've never used it.
To me, grousing about APL's unusual character set sounds a lot like grou
d
to your situation.
HTH,
Andrew
Philippe C. Martin wrote:
This is a basic question I'm sure but I do not know wether to use __builtin__,
global, or a static method:
I have a very large XML file that I load into dictionnaries defined in a class
located in a module that is imported in many pla
a scene graph that I could render as I wish.
Any pointers, ideas, or suggestions?
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
to put a monetary micropayment
into place because at that level those other factors have at
least a comparable impact.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
#x27;2.5.3.1'
Any ideas?
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Greg,
Absolutely *perfect* case for a dose of Python string concatenation
performance theory or, How To Join Strings Together Fast:
http://www.skymind.com/~ocrow/python_string/
HTH,
Andrew
On Wed, 2004-12-08 at 17:29 -0600, Greg Lindstrom wrote:
> Hello-
>
> I'm creating fixed
What about a dead camel?
--
http://mail.python.org/mailman/listinfo/python-list
mother, born a Hanson. Scandinavian heritage?
Det vet jag inte. :)
Sadly, none of them know Python. And my g'grandfather was
German in case you were wondering.
Andrew Dalke
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
reek, and
Swedish, and Japanese, and all sorts of other interesting
languages.
Given the hardware constraints of the early 1980s, which
language do you think should have been used instead of BASIC?
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Now wait a minute, shouldn't that be...
>
> PLAY "CGFED>CChttp://mail.python.org/mailman/listinfo/python-list
easy to debug chunks of code by doing (forgive
the typos as it's been a long time since I've done BASIC)
200 input "What is your name?", a$
210 print "Hi,", $a
220 print "Did you know your name has";
230 print strlen($a);
240 print " letters in it?"
256x192 graphics, 3 channels of sound,
US$525 in 1981. Worse than just about any mobile phone
these days.
And there's even an emulator, for people with the old
ROMs hanging around. Wonder if my parents still have my
old computers .
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
er wasn't there.
I know about csound and Supercollider. I don't think they
are that easy to use. They aim for power not simplicity.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ed, The "AutoIT Windows Spy" I found here:
http://www.hiddensoft.com/AutoIt/
looks like it will be useful.
Any pointers gratefully received.
Regards,
Andrew McLean
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Fredrik Lundh <[EMAIL PROTECTED]> writes
Andrew McLean wrote:
I have a requirement to drive a Windows GUI program from a Python
Script. The program was originally a DOS program written in Turbo
Pascal, and was recently translated to Delphi. I do
compile' that
I don't have reason to use in my production code. I knew them
once but have forgotten how to use in "utter fluency".
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
/F
> import random, winsound
Now if it only worked for my mac ...
:)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Are there widely used and recommended Python libraries that will let me
1) Interpret and generate MIDI messages easily?
2) Allow me to select and communicate with MIDI devices attached to my
computer?
I know that (2) is platform-dependent, so if there isn't a multiplatform
version of (
2com.client.Dispatch('Word.Application')
doc = app.Documents[0]
tables = []
for word_table in doc.Tables:
table = []
for word_row in word_table.Rows:
row = [cell.Range.Text for cell in word_row.Cells]
table.append(row)
tables.append(tabl
to have started now I would have taken a different
course and perhaps one of these newer things would have
interested me more.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
, one supported 3D placement of the audio. I hadn't
even thought of that ability.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
File "", line 1, in ?
TypeError: len() takes exactly one argument (6 given)
>>>
Is that difference a bug?
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
long with a couple pens. My new phone has
a color screen and a camera.
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
e success behavior:
apply does not work: apply() arg 2 expected sequence, found Blah
call 4
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
'm only 1/2 wrong
this time. :)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
"Peter Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This strikes me because if one can do this with instances of user
> defined classes why not with lists? Trying to use lists as dict
> keys yields "TypeError: list objects are unhashable". So why are
> list objects unhashab
Andrew Koenig:
> If d is a dict and t1 and t2 are tuples, and t1 == t2, then d[t1] and d[t2]
> are the same element.
So long as the elements of t1 and t2 are well-behaved.
>>> class Spam:
... def __hash__(self):
... return id(self)
... def __eq__(self, other):
...
"Peter Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This leads to the question:
>
> Why does (t1 == t2 => d[t1] identical to d[t2]) hold for user defined
> objects and not for lists? My answer: because the cmp function looks at
> id() for user defined objects and at list co
k of programming experience.
The software mentioned comes from Alachisoft which is a
subsidiary of Diyatech which does its software development
in "South Asia".
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 1812 matches
Mail list logo