Matthew Thorley wrote:
This may be a very rudimentary question, but here goes:
From your questions, I believe you are not thinking of values as
being distinct from the names and data structures that refer to them.
What is the parent of 23 in the following expression?
1 + 11 * 2
If you know that
Use *NIX magic. Make a named pipe to a python program that pushes stdin
to syslog and when you execute your program, redirect stdout to the
named pipe.
-jag
<>Joshua Ginsberg -- [EMAIL PROTECTED]
Brainstorm Internet Network Operations
970-247-1442 x131
On Apr 8, 2005, at 10:52 AM, Neal Becker wr
Hello --
I writing some python code to do some analysis of my mail logs. I took
a 10,000 line snippet from them (the files are about 5-6 million
usually) to test my code with. I'm developing it on a Powerbook G4
1.2GHz with 1.25GB of RAM and the Apple distributed Python* and I
tested my code on
I'd like to build a module that would redirect stdout to send it to a logging
module. I want to be able to use a python module that expects to print
results using "print" or "sys.stdout.write()" and without modifying that
module, be able to redirect it's stdout to a logger which will send the
Another solution is to just install 2.4 and then make an alias for
yum='/usr/bin/python2.3 yum' or whatever the path is :)
Edward Diener wrote:
> I can install Python 2.4 on the Fedora 3 Linux system, but after I do
> a number of Linux utilities and commands, like yum, stop working
> because they
Matthew Thorley wrote:
This may be a very rudimentary question, but here goes:
If I have a simple dictionary, where the value is a class or function,
is there an interface through which it can discover what its key is?
Similar to index() for list.
No, because mapping types (of which dict is the can
John Ridley wrote:
--- Edward Diener <[EMAIL PROTECTED]> wrote:
[snip]
I do not know whether this is a Python problem or a Fedora 3 problem
but
I thought I would ask here first and see if anybody else had the same
problem. I imagine the problem might exist on other Linux systems.
On my Mandrake
David Fraser wrote:
Edward Diener wrote:
I can install Python 2.4 on the Fedora 3 Linux system, but after I do
a number of Linux utilities and commands, like yum, stop working
because they were dependent on the Python 2.3 installation. What
happens is that Python 2.4 replaces the /usr/bin/python
Axel Straschil wrote:
>
> For unique values, I did something like that couple of weeks ago, the
> thing you would need is the getKey thing, it's fast, but needs much
> memory for big structures becouse I use two dicts.
Thanks for the tip, I may give that a try. I'll be interested to see
what kind
tuba_ranger wrote:
Yes! I moved the file (which I had created on a windows box using a
mounted drive), created a new one on the Linux box, typed in the
shabang in Linux, then copied the old file (sans shabang) to the new
file. It runs like a champ. My sysadmin suggests we run all of our
files th
rbt wrote:
Steve Holden wrote:
rbt wrote:
Steve Holden wrote:
Greg Lindstrom wrote:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which
starts with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.p
Matthew Thorley wrote:
> Can you please elaborate on this?
Eh, just have two dicts that are the inverse of each other. You could do
that by subclassinc dict:
class mydict(dict):
def __init__(self):
self.__inverse_mapping = {}
def __setitem__(self, key, value):
dict.__set
Leif K-Brooks wrote:
Steve Holden wrote:
I've even used an exception called Continue to overcome an irksome
restriction in the language (you used not to be able to continue a
loop from an except clause).
Out of curiosity, how could you use an exception to do that? I would
think you would need to
Hello!
> If I have a simple dictionary, where the value is a class or function,
> is there an interface through which it can discover what its key is?
The key of a value may not be unique, so you can also get a tupe of
keys, like dict(a=1, b=1), the key's of 1 are a and b.
For unique values, I d
Leif K-Brooks wrote:
Steve Holden wrote:
I've even used an exception called Continue to overcome an irksome
restriction in the language (you used not to be able to continue a
loop from an except clause).
Out of curiosity, how could you use an exception to do that? I would
think you would need to
On Fri, 08 Apr 2005 09:32:37 +, SÃbastien de Menten wrote:
> Hi,
>
> When I need to make sense of a python exception, I often need to parse the
> string exception in order to retrieve the data.
What exactly are you doing with this info? (Every time I started to do
this, I found a better way
Steve Holden wrote:
Scott David Daniels wrote:
Terry Reedy wrote:
On my Windows machine with 2.2.1, I get exactly what you expected:
1e1
1.#INF
...
If you get wrong behavior on a later version, then a bug has been
introduced somewhere, even perhaps in VC 7, used for 2.4.
Nope, it is also there
Can you please elaborate on this?
-Matthew
Diez B. Roggisch wrote:
>>keeping a additional mapping between values and keys.
>
--
http://mail.python.org/mailman/listinfo/python-list
>
> Is there a way to do something like that with dicts?
Not without searching the dict's items through, or keeping a additional
mapping between values and keys.
>
> On a similar note, if one object is part of another, is there a way for
> the 'child' obj to discover what/who the 'parent' objec
Maurice LING wrote:
> Matt wrote:
> > I'd HIGHLY suggest purchasing the excellent > href="http://www.oreilly.com/catalog/regex2/index.html";>Mastering
> > Regular Expressions by Jeff Friedl. Although it's mostly
geared
> > towards Perl, it will answer all your questions about regular
> > express
Michele Simionato is giving a full day tutorial
titled "The Wonders of Python" at the UK Python
Conference, Randolph Hotel, Oxford on 19 May.
(This replaces Alex Martelli, who is now working
for Google in California). The program is here:
https://www.accu.org/conference/python_tutorial.html
Thi
Joe Spammer wrote:
bah! I thought maybe they found a huge forest of rosewood trees in Brazil.
Tom (disappointed) Reese
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I'm trying to come up with a good algorithm to do the following:
>
> Given a list 'A' to be operated on, and a list 'I' of indices into
'A',
> rotate the i'th elements of 'A' left or right by one position.
Ok, here's what I've got. It seems to work right, but can it be
Steve Holden wrote:
I've even used an exception called Continue to overcome an irksome
restriction in the language (you used not to be able to continue a
loop from an except clause).
Out of curiosity, how could you use an exception to do that? I would
think you would need to catch it and then use
I am using winGuiAuto to test a program. I want to check that a
varible is set.
In the following code I am doing if(len(str(hwnd)) < 0) What is the
python way?
def clickNdSyncStopButton(hwnd=None):
if(hwnd == None):
hwnd = winGuiAuto.findTopWindow("NDSync")
if(len(str(hwnd)) < 0)
Steve Holden wrote:
rbt wrote:
Steve Holden wrote:
Greg Lindstrom wrote:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which
starts with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the co
http://www.print-it-011.blogspot.com << The Greatest News Ever !
--
http://mail.python.org/mailman/listinfo/python-list
Dear "John Perks and Sarah Mount",
> Long story short: what I'm looking for is information on how have a Python
> app that:
> * embeds an editor (or wxNoteBook full of editors)
> * loads code from the editors' text pane into the app
> * executes bits of it
> * then later unloads to make way for an
This may be a very rudimentary question, but here goes:
If I have a simple dictionary, where the value is a class or function,
is there an interface through which it can discover what its key is?
Similar to index() for list.
For a list, assuming I new what the parent list was I could do something
Yes! I moved the file (which I had created on a windows box using a
mounted drive), created a new one on the Linux box, typed in the
shabang in Linux, then copied the old file (sans shabang) to the new
file. It runs like a champ. My sysadmin suggests we run all of our
files through dos2unix befo
rbt wrote:
Steve Holden wrote:
Greg Lindstrom wrote:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which
starts with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the command
prompt the fi
Laszlo,
...
> Importing from a not package related source code is not a problem,
> really. My problem is about importing inside a package.
>
> Lib/Server/Db/__init__.py __can__ import Lib/Server/Db/Adapters usign
> relative paths, but
>
> Lib/Server/Db/Adapters/PostgreSQLConnection.py __can
Hi!
If I am missing a point here, what could it
be? Watch the hot spots (***)
Frederic
#
# Python 2.4, Windows ME
X = 0, Y = 1
class Vertex (list):
def __init__ (self, *coordinates): self [:]
= l
[EMAIL PROTECTED] wrote:
I'm trying to come up with a good algorithm to do the following:
Given a list 'A' to be operated on, and a list 'I' of indices into 'A',
rotate the i'th elements of 'A' left or right by one position.
Here's are some examples:
A = [a, b, c, d, e, f]
I = [0, 3, 4]
rotate(A, I
Uwe Mayer wrote:
> I need to read in a text file which seems to be stored in some unknown
> encoding. Opening and reading the files content returns:
>
f.read()
> '\x00 \x00 \x00<\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00...
>
> Each character has a \x00 prepended to it. I suspect its some
Steve Holden wrote:
Greg Lindstrom wrote:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which
starts with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the command
prompt the file runs as
Dylan Wilson wrote:
> Now i need to compond that string remove the whitespace if you will.Well
> i read up on strip(), lstrip() and rstrip() and all i could deduce was
> that they striped the whitespace from the start and/or end of the
> string.But I tried that anyway and failed.Is there an easier
I'm trying to come up with a good algorithm to do the following:
Given a list 'A' to be operated on, and a list 'I' of indices into 'A',
rotate the i'th elements of 'A' left or right by one position.
Here's are some examples:
A = [a, b, c, d, e, f]
I = [0, 3, 4]
rotate(A, I, 'left') --> [b, c,
Greg Lindstrom schreef:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which starts
with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the command
prompt the file runs as expected). I have
Greg Lindstrom wrote:
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which starts
with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the command
prompt the file runs as expected). I have a
> "Matt" == Matt Feinstein <[EMAIL PROTECTED]> writes:
Matt> I'm working my way through the matplotlib documentation &
Matt> there's a point that's ambiguous-- the pdf file (dated
Matt> Mar. 1, 2005) warns of dire consequences if I use the
Matt> 'wrong' array package-- e.g., pu
So finally I got the answer: there was a "parent package" feature in
the ni module but it was dropped of its awkwardness. This is not a big
loss but this is exatly the feature that I need. Is there a person on
this list who was against the "parent package" idea? He must know the
answer or a wo
On Fri, 8 Apr 2005 13:18:27 + (UTC), [EMAIL PROTECTED] (Magnus
Lie Hetland) wrote:
>Just a quick question: Does anyone have a simple way of finding the
>positions (start, end) of the groups in a regexp match? AFAICS, the re
>API can only return the contents...?
These documented methods of the
Lots of updates to the Voidspace modules and recipes.
Update to the Firedrop plugins see :
http://www.voidspace.org.uk/python/programs.shtml#firedrop
New version of FireSpell the spell checker (based on PyEnchant by Ryan
Kelly)
New plugin called FireMail which lets you send blog entries (or
articl
Hi,
I need to read in a text file which seems to be stored in some unknown
encoding. Opening and reading the files content returns:
>>> f.read()
'\x00 \x00 \x00<\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00...
Each character has a \x00 prepended to it. I suspect its some kind of
unicode - how do
[Magnus Lie Hetland]
> Just a quick question: Does anyone have a simple way of finding the
> positions (start, end) of the groups in a regexp match? AFAICS, the re
> API can only return the contents...?
Read the docs for match objects, esp. the start(), end(), and span() methods.
--
http://mail.p
Just a quick question: Does anyone have a simple way of finding the
positions (start, end) of the groups in a regexp match? AFAICS, the re
API can only return the contents...?
--
Magnus Lie HetlandFall seven times, stand up eight
http://hetland.org
Dan wrote:
>On Thu, 7 Apr 2005 21:52:11 -0500, [EMAIL PROTECTED] wrote:
>>Python strings always carry their length, and can have embedded NULs.
>> s.write("\0\1\2\3")
>>should write 4 bytes to the socket 's'.
>
>I'm taking binary data from a database, so it's not really a Python
>string. Is ther
I am using python 2.3.5 on a Linux system and have an odd problem
dealing with the 'sha-bang' line. I have a file, driver.py which starts
with
#!/usr/bin/python
and works fine (that is, when I type in ./driver.py at the command
prompt the file runs as expected). I have another file, myotherfi
Hi All--
Windows XP, uwin running on Athlon XP 3000+:
0 [/c/users/ivanlan][1] python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 1e1
1.#INF
>>>
Metta,
Ivan
Michael Spencer wrote:
>
>
oops - Sorry for the posting. This wasn't meant for the newsgroup :-)
J
Steve Holden wrote:
Jim Hargrave wrote:
http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742
You really shoud try and get out more:
http://www.pycon.org/dc2005/talks/keynote
regards
The time module has a function called 'strftime' which can retyrn the
time in the the format you want to. So you really don't need to parse
the string returned by asctime the way you are doing.
On Apr 8, 2005 6:01 PM, Dylan Wilson <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm new to python and i have a
Axel:
> So, if there are ready class-modules, and I want to use them for
> multiple inheritance, I've to rewrite the init's of classes in the
> module!
Or you use a metaclass that rewrites the __init___ method for you.
This is a start (warning: written in 5 minutes and not tested more than
you s
Hi,
I'm new to python and i have a string problem.
My problem is this
--
>>>import time
>>>time = time.asctime()
>>>time
'Fri Apr 08 22:14:14 2005'
>>>ti = time[0:13]
>>>me = time[14:16]
>>>time = ti + me
>>>time
'Fri Apr 08 22
I'm working my way through the matplotlib documentation & there's a
point that's ambiguous-- the pdf file (dated Mar. 1, 2005) warns of
dire consequences if I use the 'wrong' array package-- e.g., put
numarray in the .matlabrc file if the compile-time package is Numeric.
But there's only one curren
Yes, this is essentially the same idea. You compile the codestring to
bytecode,
whereas I just evalue the codestring to a lambda function. We are
essentially implementing a runtime macro by hand. I wonder if there is
any alternative
approach to get the same result, without manipulation of the sourc
"Michele Simionato" <[EMAIL PROTECTED]> writes:
> I have realized today that defining decorators for functions
> with generic signatures is pretty non-trivial.
I've not completely read your post ;-), but I assume you're trying to do
something that I've also done some time ago. Maybe the following
vegetax <[EMAIL PROTECTED]> wrote:
> And those thoughts comes to mind again, if python is such a great language
> why does the stdlib is so bloated with duplication,bad bad library
> design,clumsy to use modules,etc.
> I mean is this normal? i dont think so.I havent seen such a messy stdlib in
>
I said it was very little tested! ;)
This should work better:
#
def _signature_gen(varnames, n_default_args, n_args,
rm_defaults=False):
n_non_default_args = n_args - n_default_args
non_default_names = varnames[:n_non_default_args]
default_names = varnames[n_non_default_args:n_args]
Howdy,
I'm sold on out Leo, http://leo.sf.net, pure Python
amazingly easy to learn and powerful.
Based on outlining, it provides a powerful and
flexible way to manage content. Lots of built in
Python code awareness.
Extensible with plugins, a very active community
is making "I wish my editor cou
Michael Spencer <[EMAIL PROTECTED]> wrote:
>Terry Reedy wrote:
>> "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote
>>>However, on Windows (have tried on Mac, Linux) I get the following
>>>behaviour:
>>inf = 1e1
>>inf
>>>1.0
>> On my Windows machine with 2.2.1, I get exactly what you expec
I have got a solution to my problem from Thomas Heller by email.
The problem was solved by using .from_address() instead of
causing trouble cast() - here the solution as a generalized
example of code for reading access to shared memory area
with given 'appropriateName':
from ctypes import *
FILE_
__builtins__ (plural form) is a CPython implementation detail.
if you want to access the __builtin__ module, import it as usual:
import __builtin__
f = __builtin__.open(...)
if you're interested in CPython implementation details, study the CPython
source code.
Ok, I agree. I was an idio
I have realized today that defining decorators for functions
with generic signatures is pretty non-trivial.
Consider for instance this typical code:
#
def traced_function(f):
def newf(*args, **kw):
print "calling %s with args %s, %s" % (f.__name__, args, kw)
return f(*args, *
Peter Hansen wrote:
Bearish wrote:
I get 'Address already in use' errors when using sockets.
Generally one can fix this using:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
where "sock" is the server socket in question. Do
this prior to attempting to bind to the port.
-Peter
I agree
Hi,
When I need to make sense of a python exception, I often need to parse the
string exception in order to retrieve the data.
Example:
try:
print foo
except NameError, e:
print e.args
symbol = e.args[0][17:-16]
==> ("NameError: name 'foo' is not defined", )
or
try:
(4).foo
except Nam
Laszlo Zsolt Nagy wrote:
> Given this module "test.py":
>
> print type(__builtins__)
>
> I ran into a wreid thing.
>
> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> __builtins__
>
> >>>
I was messing around in google looking for the available python form
validation modules when i found this:
http://www.jorendorff.com/articles/python/path/, and i realized that is very
similar to my python fileutils module,which encapsulate,path
operations,file operations,etc.
And those thoughts co
praba kar wrote:
Dear All,
I am new to Python I want to know how to
change a time into timestamp
Is there any specific reason for not using datetime instead of time ?
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
Chris Fonnesbeck wrote:
> I have been developing a python module for Markov chain Monte Carlo
> estimation, in which I frequently compare variable values with a very
> large number, that I arbitrarily define as:
>
> inf = 1e1
Don't forget that you can write your own Infinity.
(Warning: Buggy
I've written a little application which uses the bang-line
#!/usr/bin/python
to call the interpreter. As python 2.4 comes distributed with other distroes
this breaks my application as its modules are installed
in /usr/local/lib/python2.3/site-packages/... and python2.4 does not look
there.
How d
Dear All,
I am new to Python I want to know how to
change a time into timestamp
eg "Fri, 8 Apr 2005 09:22:14 +0900" like format
date I want to change as a timestamp.
I have used below code to get timestamp
import time
time.strptime(v,'%a, %d %b %Y %X +0900')
function. This function wil
I, Tim Tyler <[EMAIL PROTECTED]> wrote or quoted:
> What do you guys think about Python's grouping of code via
> indentation?
Some relevant resources:
http://c2.com/cgi/wiki?PythonWhiteSpaceDiscussion
http://c2.com/cgi/wiki?IndentationEqualsGrouping
http://c2.com/cgi/wiki?SyntacticallySignifica
Given this module "test.py":
print type(__builtins__)
I ran into a wreid thing.
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> __builtins__
>>> type(__builtins__)
>>> import test
>>>
What
Hello NG,
yesterday I installed Python 2.4.1 (together with all the
site-packages I need for it, including Pythonwin, wxPython, py2exe,
etc...), but then I found that for some of my py2exe generated application
there were some problems. So, I came back and I re-installed Python 2.3.4
as befo
Raghul wrote:
Hi
Is it possible to login as a root in linux using python script?
What I need is when I execute a script it should login as root and
execute my command and logout from root to my existing account. IS is
possible?
Thanx in advance.
Hi,
You can compile the small .c program and setu
foten wrote:
The problem I'm having is when I'm trying to extract the
attachement using
f=open(Filename, "wb")
f.write(msg.get_payload(decode=1))
f.close()
Not the whole message is decoded and stored!
When only trying
f.write(msg.get_payload())
I see that the last 25
Lee Harr <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On 2005-04-07, foten <[EMAIL PROTECTED]> wrote:
> > The problem I'm having is when I'm trying to extract the
> > attachement using
> > f=open(Filename, "wb")
> > f.write(msg.get_payload(decode=1))
> >
101 - 178 of 178 matches
Mail list logo