?
What version of Python are you using? Is it the standard Windows
distribution?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
# here's a while statement in python.
[...]
# here's the same code in perl
[...]
So?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
in different directories.
What problems are you having?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
:
hostname = NONE
print hostname, ip_address
break
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Denis S. Otkidach wrote:
Certainly, it can be done more efficient:
Yes, of course. I should have thought about the logic of my code before
posting. But I didn't want to spend any more time on it than I had to. ;-)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
edification. I would have been considerably less annoyed if you
had done that and explained why it is better rather than nitpicking my
version.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Lucas Raab wrote:
Please see both the Python and C code at
http://home.earthlink.net/~lvraab. The two files are ENIGMA.C and engima.py
If you post a small testcase here you are much more likely to get helped.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
Paul McGuire wrote:
So A == 'a' is true in Python, not true in C.
I think you meant:
A == A
True
Er, A == 'A'
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
. You could probably get a slight speedup by using
from time import clock and then just clock().
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
is presumably many times).
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
list to lst because the former shadows a built-in.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
as well.
subprocess.Popen([sha1sum, .bashrc],
stdout=subprocess.PIPE).communicate()[0].split()[0]
'5c59906733bf780c446ea290646709a14750eaad'
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
idea. I'm sure it would happen a lot
sooner
if you submitted a patch implementing the behavior you want.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
])
z = dict((int(x[0]), .join(x[1:])) for x in (y.split() for y in (__doc__ or
_).strip().splitlines())); k = [0] + sorted(z.keys()); m = dict((b,a) for a,b in
enumerate(k)); l = k[1]
def goto(n): global l; l = k[m[n]-1]
while l and l = k[-1]: exec z[l]; l = l != k[-1] and k[m[l]+1]
--
Michael
[EMAIL PROTECTED] wrote:
I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me.
Stop worrying and learn to love exceptions. :)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Skip Montanaro wrote:
How about modifying it to
raw_input(Press ENTER to continue )
You want him to just capitalize ENTER in the current message?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
of indirection as you suggest.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Alan McIntyre wrote:
class test(object):
...def __call1(self):
...print 1
...__call__ = __call1
Is that what you were looking for?
That still only allows him to have one call function per class.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
out of the box on MinGW.
Now why haven't *you* produced a version of Python that is directly
compileable with MinGW? Time's a-wasting.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Python's
exception handling to create a version that runs on multiple systems
though, falling back to another method if msvcrt can't be imported.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Nick Coghlan wrote:
My mistake - IEC, not ISO :)
For all intents and purposes an IEC standard should be as good as an
ISO one. They usually develop standards for different areas, or jointly
if it is an overlapping area (but ISO/IEC standards are usually referred
to as ISO standards).
--
Michael
Ilias Lazaridis wrote:
Michael Hoffman wrote:
Can you please point me (and the readers) to this resource?
http://www.cygwin.com/
Why don't you solve this problem and produce a patched version of
Python that does what you want.
I'm not intrested in patching.
I'm intrested in a stable environment
. Identify
what needs to be done and create a patch, and it will be accepted if it is
a good patch.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
figure out whether this is elegant, or opaque and
to be avoided. wink
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
will escape the
bulk of the work. But not all of the work.
Since you are intent on whining rather than doing the work I'm
ignoring this thread now. Good luck.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Erik Bethke wrote:
At least I thought this was funny and cool! -Erik
Thanks. ;)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
attached below is the Perl documentation that i wrote for a function
called reduce, which is really the heart of a larger software.
Don't shadow built-ins. Especially for a function name.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
I've proposed adding a join built-in that knows about the available string
types,
and does the right thing for non-string objects.
That would be *so* useful. I frequently have to use the
.join(map(str, mylist))
idiom, which is a wart.
--
Michael Hoffman
--
http
Nick Craig-Wood wrote:
Why not have another method to do this? I propose joinany which will
join any type of object together, not just strings
I think that's what Frederik was proposing. Except that it would be
called join and be a built-in (not a str method).
--
Michael Hoffman
--
http
Max M wrote:
','.join(map(str, l))
'1,2,3,four'
Is this really that hard to do, that you want it in the library?
I think it's a sufficiently common use case that having to do that
is a wart.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
of csv.DictReader to deal with this, so I can just write:
for row in tabdelim.DictReader(file(filename)):
...
I think this is a lot easier than trying to remember this cumbersome
idiom every single time.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
first, iterable = peek(iterable)
I really like this as a general solution to a problem that bothers me
occasionally. IMHO it's much better than having UndoFiles or similar
things lying about for every use case.
Thanks!
--
Michael Hoffman
--
http://mail.python.org/mailman
!'
xlApp.ActiveWorkbook.ActiveSheet.Cells(1,2).Value = 'Python Rules 2!'
xlApp.ActiveWorkbook.Close(SaveChanges=0)
xlApp.Quit()
del xlApp
(stolen from http://www.markcarter.me.uk/computing/python/excel.html)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Max M wrote:
Isn't it about time you became xml avare, and changed that to:
f/
That makes no sense.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
thought the way the
implementor dropped it into conversation was non-obnoxious. There could
be a valuable lesson here.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Carlos Ribeiro wrote:
When people talk about the heroes of open source, you tend to hear
such familiar names as Linus Torvalds, Larry Wall, Brendan Eich, Guido
van Rossum, Monty Widenius, Miguel de Icaza, and Rasmus Lerdorf...
Of course, I had to look up who Rasmus Lerdorf was...
--
Michael
do not want. Is there a better solution?
And even if there is a better solution, can you please tell me of a way to load
the script as a module without generating the polysubc file? No points for
telling me to use python -O so I get polysubo instead. wink
--
Michael Hoffman
--
http
[Michael Hoffman]
Hi. I am trying to use unittest to run a test suite on some
scripts that do not have a .py extension.
[Sybren Stuvel]
I'd move the functionality of the script into a separate file that
does end in .py, and only put the invocation into the .py-less
script.
That's what I have
. It's the basetype flag issue. You could
propose a patch to make it subclassable.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
) to that rule as well. A
classic example is writing to a file. Even if you expect this to be
impossible, it's best to just create it and trap the exception, thereby
avoiding a race condition.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
on filenames, you can use the imp module in
the stdlib.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
of
discomfort ;) ) -- just wanted to make sure that I understood.
There are some steps to solve this issue outlined here:
http://www.python.org/peps/pep-0328.html
But the fix was not included in Python 2.4 as planned. Maybe in Python 2.5?
--
Michael Hoffman
--
http://mail.python.org/mailman
[EMAIL PROTECTED] wrote:
I have also heard excellent things about ElementTree; I haven't used it
myself though (largely because I can't find any resources on doing XML
canonicalization with it).
ElementTree/cElementTree is really easy to use and Pythonic.
--
Michael Hoffman
--
http
Worksforme:
C:\Python24python.exe -u
Python 2.4.1 (#65, May 24 2005, 13:43:04) [MSC v.1310 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
print 'hello'
hello
Strange that your python build is from 30 March and mine is from 24 May.
--
Michael Hoffman
Lonnie Princehouse wrote:
Weird. Did you build Python yourself?
No.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
, although it would be nice
to have an unbuffered text mode flag too...
so if you do this:
z = raw_input()
zzz
Does z contain 'zzz\r'?
For me, it just contains 'zzz'.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Rob Pawsner wrote:
Before I clog up the digest with details and code snippets, does this
sound familiar to anyone?
It's almost always best to post details and code snippets.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Collin Winter wrote:
If possible, I'd like to see this go in before 3.0.
+1
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
)
This is an example of polymorphism generally, not overloading.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Alex Gittens wrote:
I'm new to Python from Perl, and loving it. Has there ever been any
discussion of creating a similar resource as CPAN for Python,
PyPI.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
chimes in.
man python. Search for -W.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
Michael Hoffman wrote:
Terry Reedy wrote:
c) Check to see if Python has a startup option for suppressing warnings
As to c) python -h gives a list indicating what I thought, that -W
controls warnings, but gives insufficient info for me to use it, and
I didn't find any
:
f1( there)\
'hello there'
_f2 = wrap(howdy)
f1 = new.function(f1.func_code, f1.func_globals, f1.func_name,
f1.func_defaults, _f2.func_closure)
f1( there)
'howdy there'
Mix-and-match functions! What will they think of next?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo
probably end up using a less dirty hack :)
*Excellent* idea.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Andy Leszczynski wrote:
http://www.pythonchallenge.com/
anybody get to the level 30? :-)
No, I've run out of time. It is fun so far though.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
for this sort of text
manipulation. The language should run on Windows 98, XP and Linux.
Would Python be best, or would a macro-scripting thing like AutoHotKey
work?
Personally, I'd use Python, but what do you expect when you ask here?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo
going to *do* something with the return information, then
I would say yes. But in that case, don't use a single dict as a return,
use objects.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
need to keep the return a single dict 'cause that's what the
next step in the process expects.
I agree with John Machin, change the next step in the process instead. :)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
know of. I keep a
slightly-more generalized Surrogate class around to deal with this
pattern, and then my LineFlusherFile would be a subclass of that. But
it's the same thing, really.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
)
def __del__(self):
self.close()
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
try to use the subprocess module rather than os.popen.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
Michael, tai64nlocal is a program that converts a special packed
timestamp to human-readable form.
Thanks Peter. I was asking somewhat rhetorically but I have a love of
UNIX arcana and now I know. :)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python
John Roth wrote:
you need _both_ isinstance and the types module to do a correct
check for any string type: isinstance(fubar, types.StringTypes).
That's because both string and unicode are subtypes of one base.
But basestring, their base class is a built-in.
--
Michael Hoffman
--
http
Paul Watson wrote:
While printf() does tightly control formatting in C, it does not in
Python.
There is no printf() in Python. You should not think of print as being a
Python version of printf.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
to another program, chances are it will
not treat spacebackspace as no space at all.
I prefer building up a list and doing ' '.join(thelist) in these situations.
A much better approach. Or you can use sys.stdout.write() as others have
said.
--
Michael Hoffman
--
http://mail.python.org/mailman
face.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
for the example you used, multiple constructors are not needed.
This will get you the same result as what I imagine you wanted the
first example to do:
class myPointClass:
def __init__(self, x=0, y=0, z=0):
self.x = x
self.y = y
self.z = z
--
Michael Hoffman
Peter Hansen wrote:
Using Jason Orendorff's path module, all this code basically collapses
down to this beauty (with your variable path renamed to myPath to
avoid a name collision):
This has to be the non-stdlib library I use the most. It's a great module.
--
Michael Hoffman
--
http
it would break existing code.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
or False, mainly as a
compatibility measure for the days before they were built-ins. If you
try assigning None, CPython will refuse to compile the module, even if
the code where None is assigned is unreachable.
If there was ever a good reason to assign to None, I don't know it.
--
Michael Hoffman
Antoon Pardon wrote:
Op 2005-06-22, Michael Hoffman schreef [EMAIL PROTECTED]:
Remi Villatel wrote:
Fredrik Lundh wrote:
checking if a logical expression is true by comparing it to True is bad
style, and comparing values using is is also bad style.
I wrote it this way because, first, it's
-check-for-a-keypress-without-blocking
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
try to create a
self-contained testcase, you will have an easier time figuring where the
problem is.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
a much more convenient literal
for a dictionary. And before it was introduced I used this utility function:
def mkdict(**kwargs):
return kwargs
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
I would like to see the setuptools/PythonEggs/EasyInstall trifecta get
more attention and eyeballs. Once it is mature, I think that it will
obviate the desire for stdlibification of most of the packages being
requested here.
Looks pretty cool!
--
Michael Hoffman
compared to the alternatives above.
But that's all the syntactic sugar you need--any more will give you
cancer of the semicolon.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Americans need to know.
To be blunt, I have no idea what this has to do with Python. Surely
selecting the right forum to use indicates more sophistication and high
intelligence than the way one speaks. ;-)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
muldoon wrote:
Michael Hoffman wrote:
muldoon wrote:
Americans consider having a British accent a sign of sophistication
and high intelligence. Many companies hire salespersons from Britain to
represent their products,etc. Question: When the British hear an
American accent, does it sound
is
returned from b().
If this is of purely academic interest then the answer is I don't know. :)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
at
the beginning. And even those who pronounce it with an H sometimes say
an hotel rather than a hotel because it used to be pronounced
starting with the vowel!
Similarly, the Brits should note that idea does not end in an r and
that Eleanor does.
--
Michael Hoffman
--
http://mail.python.org/mailman
could ildg wrote:
I found dircmp compare only the direct dirs and files,
and it will not do anything to the sub-directories.
The documentation for dircmp.report_full_closure() disagrees with you.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
at that),
which doesn't use sys.ps2.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
shisa wrote:
What should I do to correct the errors accordingly?
What error? IDLE appears to be behaving as designed.
Also, please don't top-post--it makes responding to your message in a
way that others can understand more difficult.
http://en.wikipedia.org/wiki/Top-posting
--
Michael
here.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
testing, but may well be
wrong. I don't think it's critical.
He has said that open() may be used for things other than files in the
future. So if you want to be sure you're opening a file, use file().
wink
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
* the os.utime() call:
import os, sys
os.utime(foo_test_file, (0, float(sys.maxint+1)))
print hi
OverflowError: long int too large to convert to int
Looks like a bug. You should report it on the SourceForge tracker.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
, this would be very useful. You should submit an RFE on the
Sourceforge tracker.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Greg Lindstrom wrote:
I hear that Perl 6 is
going to have a rewrite of regular expressions; it will be interesting
to see what their hard work produces.
From what I saw a while ago, it didn't look like it would be any
simpler or more elegant. But that was a while ago.
--
Michael Hoffman
applies to you, feel free to ignore it, but you clearly haven't
been getting the results from this forum that you expected.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Epler wrote:
Here's the bug. You're using Windows.
QOTW (speaking as someone who is using Windows right now).
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
. As for the constructor, just call
it __init__, it will avoid confusion with __new__.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Throne Software wrote:
Throne Software has opened up a Python Forum at:
http://www.thronesoftware.com/forum/
Join us!
Why shouldn't I just stay here?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
.
The stars are magic, not the names.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
this deprecated but Guido disagreed.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
D H wrote:
See the mechanize module: http://wwwsearch.sourceforge.net/mechanize/
I second this, a very useful module. I've unfortunately had to change it
a little to deal with inevitably bad HTML supplied by web sites.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
you are assigning:
a1 = b0
b1 = a0 + b0
But when you use separate statements, you are assigning:
a1 = b0
b1 = a1 + b0 = b0 + b0 = 2*b0
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
a list instead of an iterator,
list(reversed(live))?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
and scripts than any other third-party
module, and I know it will be very helpful when I no longer have to
worry about deploying it.
Thanks in advance,
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
that is easy to Google, then I would think they were wasting
everyone's time.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 439 matches
Mail list logo