sizes, octal is nearly useless but is still carried
about for backwards compatibility.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
Jeff Shannon wrote:
now that almost the entire industry has standardized on power-of-2
word sizes, octal is nearly useless but is still carried about for
backwards compatibility.
So do you think it's worth lobbying for its removal in Python 3.0 when
we can break
that, then this idiom should be harmless even under Jython.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
the system network code instead of the application code.)
If you need to care about when the network access happens, then you
should be using the lower-level protocols -- httplib and/or socket.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
m
constructing a single hash collision to make it worthwhile to invest a
*large* number of petaflops of processing power.) Sure it's not "100%
perfect", but... how perfect do you *really* need?
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
m = get_next_module()
some_nice_function_somehow_loads( m )
that'd be
mymodule = __import__('modulename')
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
Jeff Shannon wrote:
I'd be in favor of that, unless someone can come up with a compelling
current use-case for octal literals.
Existing code. It may use octal numbers, and it would break if they
suddenly changed to decimal.
Right, which was my original point -- i
my guess being that it's towards the
hight end of that range.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
icial things, and in many cases there's real evidence to support
the contention that Python's design choices will decrease the
frequency of bugs.
Perhaps Python *is* becoming less Lisp-like... but I've never been
convinced that Lisp is the best of all possible programming l
the automatic file closing
happens as part of the object deletion, files opened in this way won't
be closed until the garbage collector runs (and collects this file
object).
Most of the time, this won't be a problem, but it's good to be aware
that things are not necessar
in
other cases it won't be, so it's important to keep in mind that the
cost exists.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
As far as I'm concerned, if you're just going to
'import *' your helper modules, you might as well leave the whole mess
as one big file, because you're throwing away almost all of the
benefits of dividing it into modules.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
st would enable you to do this
for multiple local names with a single call, but getvinfo() doesn't
try to do that...
Don't forget, in Python, all names are references. You only have to
be careful when you start re-binding names...
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
Op 2005-03-16, Jeff Shannon schreef <[EMAIL PROTECTED]>:
Bruno Desthuilliers wrote:
- if x is a class attribute of class A and a is an instance of A,
a.x=anyvalue create a new instance attribute x instead of modifying A.x
This is very consistent with the way that bin
raise ValueError("...")
The for/else pattern may look a bit odd, but the key feature here is
that the else clause only runs if the for loop terminates normally --
if you break out of the loop, the else does *not* run.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
lopers working on OO.o), it's not too surprising
that OpenOffice hasn't changed that much.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Raymond Hettinger wrote:
def count(self, value, qty=1):
try:
self[key] += qty
except KeyError:
self[key] = qty
I presume that the argument list is a typo, and should actually be
def count(self, key, qty=1): ...
Correct?
Jeff
Now(tm), though, now that 2.4 is officially released.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
ll have 2.4-compiled binary
distributions pretty soon.
As for 2.3 being broken, check your application path and file
associations. You may be inadvertently running the 2.3 version of
Pythonwin under the 2.4 interpreter.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mai
ou
can try reinstalling 2.4, uninstalling the packages, and then
uninstalling 2.4 again... or, if the packages' files were deleted when
Python was uninstalled, you may have to hack your registry to remove
those entries from the uninstall list.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
;""My
"foo" object"""), then things break down again.
In order to handle this sort of nested structure with anything
resembling true reliability, it's necessary to step up to a true
lexing/parsing procedure, instead of mere string matching and regular
such
special-case behavior would be extremely foolish to do...)
Of course, I'm just going off of what I remember having been said
elsewhere on c.l.p., and I wouldn't recommend anyone betting their life
savings on the reliability of my memory... :)
Jeff Shannon
Technician/Programmer
Credi
Steven Bethard wrote:
Jeff Shannon wrote:
Note also that functions which use exec cannot use the static
namespace optimization, and thus tend to be *much* slower than normal
functions
In what circumstances will this be true? I couldn't verify it:
[...]
exec """\
def fib2
ed-length block.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
eference C++ members despite the fact that 'this'
was not required, just because I wanted to be able to *see* which
variables were members and which weren't...)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
have my modules use 'from
const import const'. But I will admit that the extra complication on
import may not be worth the "cleaner" module internals... As always,
it's a tradeoff, and each programmer must decide which costs are worth
bearing in their particular situ
a
UI to use that code in IDLE. An optional stage two could then be
rewriting the name-finding code to be smarter.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
hon
code is slow, and not all C code is fast, and if you're writing C from
scratch then you want to be sure where the hotspots are and focus on
converting only those areas to C.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
7;s called, an instance of this class is created. All subsequent
calls just return a reference to the same instance. This ensures that
any changes to the instance are reflected anywhere that the object is
used. (In your code, only changes to the class SW1_DICT are reflected
elsewhere, not changes
VS.NET, and hopes to have wxPython built
for 2.4 Real Soon Now(tm).
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
her copyright information.
>>> type(list)
>>> class my_list(list):
... pass
...
>>> type(my_list)
>>> l = my_list()
>>> l.append('foo')
>>> l.extend(['bar', 'baz'])
>>> l[2]
'baz'
>>> l
[
pdated the
website yet. ;) But Windows installers for 2.4 are available on
Sourceforge...
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
x27;APPDATA'] might be useful as
well. Of course, if you're trying to get something to work
cross-platform, things may be more difficult -- but that's because
Windows doesn't normally use ~ so its use is not supported very well.
You may be able to create a $HOME that's eq
Simon Brunning wrote:
On Wed, 15 Dec 2004 18:10:40 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
The difference being that when Excel opens up a *.CSV, it goes through
the import wizard.
Are you sure that's true? When I open a *.csv file, Excel *appears* to
open it without
Peter Hansen wrote:
P.S.: I'm only half Danish, but the other half is from
a particularly bloodthirsty line of Canadians.
I thought it was physically impossible for Canadians to be bloodthirsty
outside of hockey games... ;)
Jeff Shannon
Technician/Programmer
Credit International
--
t some of the time (by postulating, for example, that if one
mutates a dict key then things will break), this will result in more
bugs and more confusion over time. There is no way for Python to be
able to behave consistently in the face of mutable dict keys, therefore
("In the face of ambigu
Antoon Pardon wrote:
Op 2004-12-16, Jeff Shannon schreef <[EMAIL PROTECTED]>:
nevermind the fact that I can't think of a case where I'm
likely to "retrieve" a key from a dict, modify it, and then put it
back. (I can think of endless cases where I'd want to
re only as a matter of backward compatibility.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
Op 2004-12-17, Jeff Shannon schreef <[EMAIL PROTECTED]>:
(And I have to reiterate, here, that I have *never* felt it a hardship
to be unable to use lists as dictionary keys; it's just never come up
that the data that I had in a list was something that I wanted
Antoon Pardon wrote:
Op 2004-12-17, Jeff Shannon schreef <[EMAIL PROTECTED]>:
To take another approach -- given some function that allows lists to
(pretend to be) hashable:
.>>> key = [1,2]
.>>> d[key] = 'foo'
.>>> d[[1,2]]
.>>> key.a
n lambdas is a direct consequence of the fact
that a function def is an executable statement rather than a
compilation-time declaration.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Mike Meyer wrote:
Jeff Shannon <[EMAIL PROTECTED]> writes:
Additionally, as I understand it UserList and UserDict are implemented
entirely in Python, which means that there can be significant
performance differences as well.
Actually, UserList and UserDict are just wrappers arou
Roy Smith wrote:
Jeff Shannon <[EMAIL PROTECTED]> wrote:
The aesthetic purity I'm referring to is that Python respects the proper
meaning of hashing, even if it doesn't force the programmer to. The
builtin objects that Python provides don't offer a __hash__() method
t
tually a parameter to findRoot(). I
suppose that opinions may vary, however.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
Jeff Shannon wrote:
It occurs to me that, in a statically compiled language, function
definitions all happen before the program starts, and thus that
definition can't be affected by other variables (i.e. an outer
function's parameters).
I think you might be
Jp Calderone wrote:
On Fri, 17 Dec 2004 11:21:25 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
No -- the mathematical definition of 'hashable' fails for mutable types,
and Python doesn't try to pretend that it can hash mutable types.
Python also provides features
from
.ini-style files and/or the Windows Registry.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
may be able to store your data in a shelve, or
even proper database, saving you lots of time in parsing through these
files on each run. Even if it's entirely new data on each run, you may
be able to find a more efficient way of transferring data from whatever
the source is into yo
g gets done correctly, since you won't
have the option of setting the formatting explicitly during import. (I
frequently deal with numbers that have significant leading zeros, and
Excel just loves to strip those off unless you set formatting to 'text'...)
Jeff Shannon
Te
were copied when added
to a dict, just so that every once in a while someone might be able to
avoid a few conversions to/from tuple, then you're adding the overhead
of an object copy to *every* dict insertion, thus slowing down (possibly
by a significant amount) a large proportion of Py
rectory
to add to sys.path. Thus, if you drop a mymodule.pth file in
site-packages, which contains a list of the directories you're
interested in, sys.path will automatically be amended for you every time
Python starts.
Jeff Shannon
Technician/Programmer
Credit International
--
http:/
possible to behave
sensibly. So prove us wrong, by implementing something that behaves
sensibly in the face of mutating keys (which compare by value, as lists
do, rather than by identity).
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
Op 2004-12-17, Jeff Shannon schreef <[EMAIL PROTECTED]>:
Now, even if hash were made to equal id... suppose I then pass that dict
to a function, and I want to get the value that I've stored under
[1,2]. In order to do that, I'd *also* have to pass in
re was what wouldn't work
consistently; the corrected version, using list() and reverse(), doesn't
look like it has anything that'll be a problem in my 2.2 installation,
and probably not in 2.1
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
bring you back up to the top of the loop body and the
start of the next loop iteration.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.
... except in the US, where we stubbornly apply the same spelling to
both of those. (It figures that we Americans just ignore subtle
distinctions)
Jeff Shannon
Technician/Programmer
specification, and then write code that would pass the unit tests. If
you are subclassing from a common base, then you'd only need to change
the unit test for that common base class (presuming that all derived
classes would run those unit tests as well).
Jeff Shannon
Technic
Antoon Pardon wrote:
Op 2004-12-21, Jeff Shannon schreef <[EMAIL PROTECTED]>:
Antoon Pardon wrote:
So show us a dictionary (i.e. hash table) implementation that can do
this.
Why should I, Do you doubt that it is possible?
Yes.
You'll need to be able to derive the old ha
Antoon Pardon wrote:
Op 2004-12-21, Jeff Shannon schreef <[EMAIL PROTECTED]>:
How does the dict know which value is associated with which key?
Because there is a link between the key and the value. The problem
with a mutated key in a dictionary is not that the link between the
key a
rrent dict off of object
id, I don't see much real value in creating a separate dict type that
does it by default. But as long as it's an addition, rather than a
change to existing behavior, then the only real problem with it is the
standard "makes the language bigger".
more bother than it's worth to me.
I'm perfectly willing to "struggle" along without abstract base classes
enforcing an interface, and merely make do with unenforced, informal
protocols... but then, I'm hardly an expert in such matters. (Or any
other sort
ld be able to
avoid the circular import problem...
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
meric that are required, and
then ensure that you have (or get) an appropriate version.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
-- it doesn't happen automatically.)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
almost identical) instances of Spam. Using
list() to create a copy of a list is analogous, but we're used to
thinking of list() as a converter rather than a constructor...
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
18 STORE_FAST 0 (y)
21 LOAD_CONST 0 (None)
24 RETURN_VALUE
>>>
Given that Python may not even have access to the .py file, only the
.pyc (which has lost all record of the source representation), there's
no way for the interpreter to do
alphabet /
character set, but even then there's a significant weight of historical
reasons to overcome.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
e purpose
without quite as much risk of code pollution.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
27;s attempts to get
away from the tyranny of the straight line, and even with the EMP
there's certain details which turned out well, but the overall effect
is that of an overturned garbage pail.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
On Thu, 30 Dec 2004 15:15:51 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
Mimicking function-def indentation inside of another function's arglist
strikes me as an abomination just waiting to happen; in comparison, the
need to type a name twice seems trivial.
Sel
Antoon Pardon wrote:
Op 2005-03-18, Jeff Shannon schreef <[EMAIL PROTECTED]>:
I find it odd that you start by saying you still find them very
consistent and here state there is a slight inconsistency.
I said that the way that binding a name on a class instance always
creates an instance att
- the capture app would pass (almost) all input to the child
app and then retrieve the child app's output (and probably perform the
actual display on-screen). This won't let you capture the text of an
arbitrary window, though, and would probably be pretty fragile.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
trol-variable tuples are not so straightforward as is being
claimed.
There may be valid arguments in favor of enhancing tuple unpacking in
this way (indeed, I believe I recall a thread or two on this subject),
but it's important to consider the general consequences, not just the
single aspect of f
Peter Hansen wrote:
Jeff Shannon wrote:
Unless I'm seriously mistaken, the only way that this will be possible
is if there's a Win32 API call that will give the correct information.
This might be possible to find in the MSDN documentation, if it
exists, but I suspect that it probab
101 - 174 of 174 matches
Mail list logo