ures either present or lacking
in C++.
Ultimately, manageability of a project is far and away more about the
people involved and the techniques used than it is about any single
technology involved.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
(text, chunks)) == [(3, 10), (11, 22), (24, 40), (44,
47), (48, 51)]
if __name__ == "__main__":
main()
Not tested beyond what you see.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
een by using the TOP
command. This sort of thing is entirely non-standard and you can't rely
on it in general, AFAIK.
A better approach would be to have your client software track the
Message-ID header, but something tells me you are interpreting "seen" as
meaning "anyone has RETR
nd
this would probably be an excellent way to learn more about them, even
if you don't get the best solution.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
bably incorrect in the specifics of the call to ctime(), but
reading the documentation for "datetime" after you've learnt the basics
of Python should solve that.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
myscript.py
if exist c:\temp\_mycd.bat call c:\temp\_mycd.bat
somewhere inside myscript.py
newDir = r'c:\Program Files'
f = open(r'c:\temp\_mycd.bat', 'w')
f.write('''rem This file generated by myscript.py
cd = %s'''
Peter Hansen wrote:
> Ivan Shevanski wrote:
>> Alright well I'm quite a noob and when I run a simple command to
>> change the current directory, nothing happens. I made a little test
>> script to show it:
>
> Generally, the only way to use an application (i
Simon Brunning schrieb:
> Sibylle Koczian needs to sort part of a list. His first attempt made
> the natural mistake - sorting a *copy* of part of the list:
I think it was _her_ first attempt.
--
---
Peter Maas
runner
or other utilities. Running tests (always from a console) takes only a
few seconds so we can do it often. Multiple projects are easily
supported in other directory trees.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Dan Sommers wrote:
> Peter Hansen <[EMAIL PROTECTED]> wrote:
>>This problem is well suited to the abilities of genetic algorithms,
>>and this would probably be an excellent way to learn more about them,
>>even if you don't get the best solution.
>
> Ther
rogram
"scripts", but I think that's probably just out of habit or association:
calling single Python source files "scripts" is so common, even if they
aren't scripts in the sense of "individually executable files written in
a scripting language" any more.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
to everyone who responded
> I'm really getting along here.
So basically "os.system" would have done exactly what you wanted if
you'd tried it on "mame" instead of using "cd", for reasons we've now
covered. :-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
of doing this?" in
relation to paths is always "yes, use Jason Orendorff's path module".
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Mike Meyer wrote:
> Yes. I once grabbed an old program that did assignments to None. But
> that's always been a bad idea.
What was the use case!?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
t;> A.value.__get__(a)
42
>>> sorted([A(42), A(2), A(4)], key=A.value.__get__)
[A(2), A(4), A(42)]
Peter
--
http://mail.python.org/mailman/listinfo/python-list
;computer programming
> for every C-programmer".
Huh? Where did that come from? Functions are objects in Python and
I've not heard the least discussion about this being changed, until now.
Sean, what gave you the impression this would change?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
gt; Is it right that two Wax proposals were accepted?
"Right" can mean either "correct" or "proper". Which did you mean?
If you meant the first, then the above link clearly shows that there
were in fact two different Wax proposals (from different people) accepted.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Crust. Then find the
source for PyCrust in the wxPython folder (under your lib/site-packages
folder in c:\python24) and start reading.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
its own ZODB. What proprietary
database is involved?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
characters.
> [snip]
> Any suggestion is welcome,
It might help if you showed us the output of "repr(x)" where x is the
output of the campovalore.encode('iso-8859-1') part above.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Florian Lindner wrote:
> Peter Hansen wrote:
>>[Zope] doesn't include
>>database interfaces other than to its own ZODB.
>
> That's not correct. Zope2 includes DB interfaces to MySQL, PostGre, ODBC and
> many others.
It actually *includes* them? I thought t
lling A.__init__ recursively, giving you an eventual
stack overflow).
-correcting-bengt-richter-on-such-arcana-is-always-dangerously y'rs,
Peter
--
http://mail.python.org/mailman/listinfo/python-list
s...'
If you *don't* have the ability to change the print statements like
this, then you can install a Redirector in place of sys.stdout, but that
will affect all prints, including those in standard library modules and
elsewhere.
HTH
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
;m not too concerned about
the resolution, though better than one second would be useful.
Thanks for any suggestions.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> Peter Hansen <[EMAIL PROTECTED]> wrote:
> If you get the UTC time, daylight savings time doesn't enter the equation.
Of course... I didn't think of that approach. I don't actually care
about absolute time, so this should work fine for at least t
Roy Smith wrote:
> Peter Hansen <[EMAIL PROTECTED]> wrote:
>>I'll have to look into how to set up Windows XP to prevent users from
>>changing the time on their own, assuming that's possible.
>
> On a single-user system like Windows, you pretty much have
Roy Smith wrote:
> Peter Hansen <[EMAIL PROTECTED]> wrote:
>>Using time.time() doesn't appear to be suitable, since time might jump
>>forwards or backwards at the user's whim, if the system clock is reset,
>>or when a daylight savings time change occurs.
&
It?
>
> Nope, sorry, still not getting it.
If you were serious, Google would be a real good friend here, since the
answer is in its first search result... without even having to click on
the link! Heck, it even points you to the web site: http://tmtowtdi.com :-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Terry Hancock wrote:
> On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote:
> And for that matter, some of the posters here have *been* 14.
Terry, almost every single one of the posters here have been 14.
At some time. :-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
sequence = map(float, range(10))
r = reduce(lambda x, y: x*y-1/y, sequence)
s = my_reduce(lambda x, y: x*y-1/y, sequence)
assert r == s
:-)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
If it's a executable file, a ".exe" file, you can launch it in this
way, "xxx.exe < input.txt". The text file "input.txt" will be
considered as the standard input.
But when I use this trick on python, it doesn't work. The only way to
do so is like this "python xxx.py < input.txt". But this method
Sounds pretty close to old-style BASIC
and since I've come that route too (in the distant past), this may not
be a coincidence.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Peter Cai wrote:
> Thus, you
> can execute you "py" program anywhere by using the command "xxx.py",
> but when you want to use an exsiting file as it's input, you have to
> use something like "pythong xxx.py < input.txt".
This is apparently a bug
ose who seem most concerned are actually more
worried about losing the free support of a team of expert developers as
those developers evolve their vision of the language, than about losing
access to something as minor as reduce().
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
On 7/2/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:
> A.M. Kuchling wrote:
> > For anyone who's interested: the Python wiki now contains a list of the
> > PSF-mentored proposals that were accepted for Google's Summer of Code:
> > http://wiki.python.org/moin/SummerOfCode
>
> Is it right
ike so:
dir([])
Note in the output the presence of the "index" method... I'll leave it
up to you to read the docs to learn more about how to use it, or you can
just experiment at the prompt to see how it works.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Peter Decker wrote:
> On 7/2/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:
>>Is it right that two Wax proposals were accepted?
>
> Or that Wax is being promoted over Dabo
"Promoted"? Do you know if any Dabo proposals were even made? And how
good the pro
approaches (such as Roy suggested in his other post)
may well be more appropriate depending on the context.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
On 7/3/05, Robert Kern <[EMAIL PROTECTED]> wrote:
> I would suggest not speculating on biased or malicious intentions. It is
> possible that no one applied with a proposal to work on Dabo, or that
> such a proposal was poorly written, or that the author had too little
> experience, or any number o
James wrote:
> Peter Hansen wrote:
>>I edit in the Scite window, hit Alt-Tab (under Windows XP) to change
>>focus to the cmd console (and instantly all my modified files are
>>saved), press the Cursor Up key to retrieve the previous command (which
>>is generally the name
Florian Lindner wrote:
>>>Peter Hansen wrote:
>>>>[Zope] doesn't include
>>>>database interfaces other than to its own ZODB.
>
> Ok, you're right. But I don't really think it makes a difference to install
> them afterwards.
Probably not,
better
approach to ensuring your code "does the right thing" in the future, and
"file" should still be used in the rare case where you actually want to
test whether something is a particular type of thing.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
George Sakkis schrieb:
> Given that the latest 2.x python will be 2.9
Why not 2.13 or 2.4711? Version strings are sequences of arbitrary
integers separated by dots and not decimal numbers, or are they?
--
---
Peter Maas,
Huron wrote:
> Hi Peter,
> Thanks for you detailed reply.
> The layout that you suggest sounds wise to me (I'm about to start a
> project).
I wouldn't necessarily recommend something so complex (not that it's
particular complex, but it's more than just "fla
Huron wrote:
> For instance, if you have several classes implementing the same
> interface
> (say, doing the same things with different strategies), how would you
> organize that in terms of files (modules) and directories (packages) ?
A concrete example would probably help. What are you
ied about time.time(), it will be quite sufficient
when used in conjunction with a threatened slap on the wrist (or a label
on the side of the monitor) for any user who tries to change the
clock... (Thanks, Tim! time.time() makes sense finally.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
roblem is. This will help you
in the future, even if k33rni's answer solves your immediate problem...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
eration. And for most of us, English comes
> easier than Computer Science jargon.
And with a better choice of names than "x", that line becomes even more
self-documenting.
[str(parrot) for parrot in sequence], for example, tells you much more
about what is going on than s
;t think of when you wrote it
and that implement the same methods and attributes but are of a totally
unrelated class (google for "duck type").
Peter
--
http://mail.python.org/mailman/listinfo/python-list
in 2.3 which you were
> running.
But arg 2 *is* a tuple. So a least the error message is wrong, too.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
s wondering is if the sleep will pause the t
> thread as well as the main function or is the thread independat of the
> main function sleep?
Your code is very close to working already... why don't you just run it
and observe how it works?
In any case, the answer is "no, time.s
nt conflict in the two philosophies embodied
by the "simple little programs" and the "emacs" approaches.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ilable (even if they _aren't_ on the same machine!).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
carry on with useful work.
Really, the name is such a trivial, unimportant part of this whole thing
that it's hardly worth discussing. The syntax is more important, and
the limitations are of definite interest. Not the name.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
n to be the fastest language to develop in, so
far, but it's quite possible to imagine another language in the future
which I might learn which would be -- for me -- even faster, at least
for certain types of problems. (But so what? :-) )
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
of part
of the list and sure enough the original has never been changed.
> What am I missing ?
That slicing makes copies. If you directly access the element in the
first list (without using a slice) it will work.
(I think I've got most of the correct...)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
= 'W':
I think you might have a problem with the above, where it seems you
changed from one approach to another part way through solving the
problem... should throw a NameError pretty quick when you run it though.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jonathan Ellis wrote:
> Peter Hansen wrote:
>>Or investigate the use of Irmen's Pyro package and how it could let you
>>almost transparently move your code to a *multi-process* architecture
>
> Unless you're doing anything that would require distributed locking.
&
nly a single index as you have in l[-1] is just a reference to one
element in the list.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
a reply (though I suspect most people there read this forum as well).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ultiple
interpreters"? As I understand the concept, and based on my several
years' old reading of the virtual machine code, I wouldn't say there are
multiple interpreters.
There's a reason the GIL is the *global* interpreter lock...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
del: how would I, in doing automated testing,
ensure that I've returned everything to a "clean" starting point in all
cases if I can't delete variables? Sometimes a global is the simplest
way to do something... how do I delete a global if not with "del"?
-Peter
--
refore Assembly is clearly the fastest development language.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
def Iterator(self): yield 42
class Beta(Base):
def __getitem__(self, index):
return [1, 2, 3, "ganz viele"][index]
for item in Alpha(): print item
for item in Beta(): print item,
print
Peter
--
http://mail.python.org/mailman/listinfo/python-list
MT'
seconds = time.mktime(time.strptime(s, '%a, %d %b %Y %H:%M:%S %Z'))
However, I also need conversions to localtime. Setting TZ to UTC
before importing the time module won't let me do this. Changing
TZ after importing time has no effect.
--
Peter Kleiweg L:NL,af,da,de,en,
00
> py>
>
> You can use time.time() to get the UTC time, then add the offset.
The offset is for this moment, not for the date and time of the
string parsed.
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
> Peter Hansen wrote:
>>Tom Anderson wrote:
>>>How about just getting rid of del?
>>
>>Arguing the case for del: how would I, in doing automated testing,
>>ensure that I've returned everything to a "clean" starting point in a
occur once every week or two
with an NTP client running. It certainly doesn't cause the one hour
jumps forwards and backwards which I and the author of that page both
thought it would.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jonathan Ellis wrote:
> Peter Hansen wrote:
>>I can't address the issue of whether or not "most" such projects require
>>distributed locking, because I'm not familiar with more than half of
>>such projects, as you appear to be.
>
> Your sarcasm is c
Grant Edwards wrote:
> On 2005-07-06, Peter Hansen <[EMAIL PROTECTED]> wrote:
>>Maybe you should consider and explain what you mean by
>>"multiple interpreters"?
>
> That in a multi-theraded Python program, the code that
> impliments the Python VM is
have a look at the "timeit" module aswell
GregM wrote:
> Hi,
> I'm hoping that someone can point me in the right direction with this.
> What I would like to do is calculate the average time it takes to load
> a page. I've been searching the net and reading lots but I haven't
> found anything that
Giles, you keep mentioning syntax errors as the (/a) cause of the
problem. I suggest you avoid such problems, so that the import sethook
approach, et al. will actually work. The easiest thing to do is to run
PyChecker on your script prior to executing it. PyChecker will catch
your syntax errors
ript will run for a while before
> throwing this error, but sometimes it throws it right away.
Often posting the actual traceback, cut and pasted without editing, is
highly effective at helping us provide a useful answer...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ompiler thinks it must be a local,
but you access it (as the error says) before it is assigned-to locally.
"A" fix would be to use a different name locally, and if you really want
it to reference the externally defined "fields", just do something like
"lfields = fields" at the top of cutbits() (where "lfields" means
"local fields", though you can pick any name you like).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
2, 3] ??
No, the discussion is about list comprehensions. [1,2,3] is not a list
comprehension, as you know.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
.)
(Hint #2: maybe explaining why you don't want this to happen would help
too, since that will probably determine the "best" solution.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi all, Any one got idea about how to set undisclosed recipient? I put
> all recipient in BCC field while the To field don't want to leave
> blank. but neither fail to place an empty email address nor i don't
> want to put my own email address inside. www.bartekrr.info
J
onsider first whether one
or the other approach is clearly more expressive (for future
programmers, including yourself) in the specific case involved.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
rse
> these as arguments?
Doesn't that depend on what you plan to do with them? Do you want them
as a special Range object, or a series of integers, or a list of tuples,
or what?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Devan L wrote:
> I see a total of 12 posts and 8 users.
Which at least makes it a record so far, surpassing every other "hey, i
just made a new forum, it's awesome and everyone should join!" post that
has been made here in the past, by about 9 posts and 5 users... ;-
- even though
> 2.4 is backwards compatible.
Python 2.4 is most definitely not 100% backwards compatible with Python
1.5.1, so "don't upgrade!" is correct advice if Python is in use by some
application that expects it to be 1.5.1...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
containing assertions about the predicates
written in LSL, the Larch Shared Language common to all. "The Larch
Family of Specification Languages", J. Guttag et al, IEEE Trans Soft Eng
2(5):24-365 (Sep 1985). "Larch: Languages and Tools for Formal
Specification", Guttag and Hor
tionary and bound to the second
argument, and then that second argument is returned as the value.
(I always have to ignore the name to think about how it works, or it
gets in the way of my understanding it. The name makes fairly little
sense to me.)
-Peter
--
http://mail.python.org/mailm
ge for past patches would give an answer, since it seems likely
someone has already tried.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ity function that does what you want (by using the first technique,
if you wish), and then calling it will be as simple as lst.index()
And no, since you are basically doing a form of pattern matching, I
don't think there's a shortcut.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
quot;, 20), (3, "c", 30)]
>>> class Key(object):
... def __init__(self, key):
... self.key = key
... def __eq__(self, other):
... return self.key(other)
...
>>> items.index(Key(lambda x: x[2] == 20))
1
>>> items.index(Key(lambda x: x[1] == &qu
deas on how this might be done?
>>> class Vector(tuple):
... x = property(lambda self: self[0])
... y = property(lambda self: self[1])
... z = property(lambda self: self[2])
...
>>> Vector("abc")
('a', 'b', 'c')
>>> Ve
and".join("C1, C2, C3".rsplit(",", 1))
'C1, C2 and C3'
Peter
--
http://mail.python.org/mailman/listinfo/python-list
ammers together, and
it is the responsibility of both partners to encourage^H^H^H^H^H insist
that the refactor "make it right" stage must occur _now_, before we
check the code in. If you skip this step, you're failing to be an agile
programmer, and your code base will become a tar p
(Fixed top-posting)
James Carroll wrote:
> On 7/11/05, Peter Hansen <[EMAIL PROTECTED]> wrote:
>>(I always have to ignore the name to think about how it works, or it
>>gets in the way of my understanding it. The name makes fairly little
>>sense to me.)
>
print "Collision!!!"
> print make_string
Set the flag here, then do the break:
keepGoing = False
> break
Tada...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
On 7/12/05, Dark Cowherd <[EMAIL PROTECTED]> wrote:
> Most lists when i hit reply it puts the list address back in the To
> address and some lists allow you to configure this.
>
> But in this list reply sends the mail back as a private mail and there
> seems to be no option to configure this.
>
"Document Management Software" is a little vague. What do you want it
to do? In general though, when someone says "content management" and
"Python", the general response is Zope, usually with Plone on top.
--
http://mail.python.org/mailman/listinfo/python-list
ot;")
...
>>> f = StringIO("0123456789")
>>> for c in chariter(f):
... print c
... if c == "2": break
...
0
1
2
>>> f.tell()
3
Performance is probably not so good, but if you really want to do it in C,
with cStringIO you might be /almost/ there.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
als() returns "module level" stuff only when executed
_at_ module level (i.e. not inside a function). Otherwise it will
return only the local variables of the frame its in.
Better is this, since it works for the OP's requirements in either
situation.
globals()['dothat&
kwargs and **x are somehow magically different?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
erally find that more readable than the one with globals(),
and I don't offhand recall any serious criticism of globals() on grounds
of either readability or style, so I'm unsure why anyone would prefer
the alternative.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
d be more effective in getting useful
answers. (For example, what kind of server are you talking about?)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Lotze wrote:
> Peter Otten wrote:
>
>>>>> class frankenstring(StringIO):
>> ... def next(self):
>> ... c = self.read(1)
>> ... if not c:
>> ... raise StopIteration
>> ... retu
Scott David Daniels wrote:
> iter(elem in lst if elem[3] == x).next()
>
> Does this look any better? At least it stops when the answer is found.
Next time you'll recommend
if (a>b) == True:
# ...
Watch out, you're on a slippery slope here :-)
Peter
--
http://m
2501 - 2600 of 9344 matches
Mail list logo