the adjecent indexes for each square
would be a possible hybrid solution. In effect every square would
contain pointers to all its neighbors.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
is not available in
this version
The latest Windows build has the Python bindings included. The
one I have is version 7.0. Earlier Windows binaries didn't
generally have it.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
recommend Koenig Moo _Accelerated
C++_.
It's not enough C++ to join a C++ team at a professional
development house (of course no book can provide that), but it's
all the best bits.
If you get through that, then proceed directly to the source,
Stroustrup _The C++ Programming language_.
--
Neil
/
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-02-13, hg [EMAIL PROTECTED] wrote:
Hi,
Considering the float 0.0, I would like to print 00.00.
I tried '%02.02f' % 0.0 ... but I get 0.00
Any clue ?
Yes. How wide (total) is 0.00, compared to 00.00?
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-02-13, hg [EMAIL PROTECTED] wrote:
Neil Cerutti wrote:
On 2007-02-13, hg [EMAIL PROTECTED] wrote:
Hi,
Considering the float 0.0, I would like to print 00.00.
I tried '%02.02f' % 0.0 ... but I get 0.00
Any clue ?
Yes. How wide (total) is 0.00, compared to 00.00?
--
Neil
under-the-hood pointer-fu, use C.
C++'s standard library seems such a huge win over the C library,
that I'd hate to switch back. Of course it has its warts and
cancers, but it's an awesome accomplishment. And you *can* get
harder-to-use C versions that are basically portable.
--
Neil Cerutti
into
a dumb while loop.
I don't believe Python does tail call optimization; at least it
isn't document that it does it.
--
Neil Cerutti
The audience is asked to remain seated until the end of the recession.
--Church Bulletin Blooper
--
http://mail.python.org/mailman/listinfo/python-list
it with lambdas, but it would be nice if the final
function was a lambda.
How would it being a lambda help you?
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-02-14, Peter Otten [EMAIL PROTECTED] wrote:
Neil Cerutti wrote:
On 2007-02-13, Peter Otten [EMAIL PROTECTED] wrote:
Well, what problems ocurring with
class A: pass
class B: pass
class C(A, B): pass
could be avoided by writing
class A: pass
class B(A): pass
class C(B): pass
that it wasn't
until *after* reading _Effective C++_ (Scott Meyers), that I
noticed this.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
of the + operation followed by
the assignment operation.
--
Neil Cerutti
I don't know what to expect right now, but we as players have to do what we've
got to do to make sure that the pot is spread equally. --Jim Jackson
--
http://mail.python.org/mailman/listinfo/python-list
. Even though they
aren't in any sequence, it's still useful to iterate over them.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
.
What Python provides is dynamic polymorphism of names with
single-dispatch.
I think. ;-)
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-02-15, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Wed, 14 Feb 2007 10:41:53 -0300, Neil Cerutti [EMAIL PROTECTED]
escribió:
So the effect is that mutual recursion isn't actually any
harder.
But some kind of language support is required in this case. At
least I don't know how
):
...
class InStream(object):
...
class OutStream(object):
...
class InOutStream(object):
...
I always get myself into trouble when I try to design a class
hierarchy *before* I see something like that.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-02-15, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Thu, 15 Feb 2007 13:37:19 -0300, Neil Cerutti [EMAIL PROTECTED]
escribió:
On 2007-02-15, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Wed, 14 Feb 2007 10:41:53 -0300, Neil Cerutti [EMAIL PROTECTED]
escribió:
So the effect
of external support: one can't
eliminate the call just by transforming the program.
Ah, I see now. Had my blinders on.
--
Neil Cerutti
Low Self-Esteem Support Group will meet Thursday at 7 to 8:30 p.m. Please use
the back door. --Church Bulletin Blooper
--
http://mail.python.org/mailman
would be:
pre
while cond:
code
post
No, when you consider the continue statement, which which Python
also supports.
for (pre; cond; post) {
continue;
}
That's not an infinite loop in C, but the Python while-loop
version would be.
--
Neil Cerutti
--
http://mail.python.org/mailman
to
tell you?)
--
Neil Cerutti
Baseball has the great advantage over cricket of being sooner ended. --George
Bernard Shaw
--
http://mail.python.org/mailman/listinfo/python-list
, the universe, and everything.
Yeah, but I was hoping the question would've turned out better.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
-starts with a
manual transmission, but not with an automatic transmission.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
Dubbi again.
Let's see here... Ubububythubububonubpubay
That's what I call ubububeautubububifubububulbubay.
--
Neil Cerutti
This is not a book to be put down lightly. It should be thrown with great
force. --Dorothy Parker
--
http://mail.python.org/mailman/listinfo/python-list
be happy to know that iterators and list comprehensions
will make your code better after you upgrade. ;-)
In the meantime, I think your (relative lack of) error handling
is OK. GIGO, as they say (garbage in, garbage out).
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
true, C++ compiler vendors, for example, take
backwards compatibility significantly less seriously, it seems
to me.
Compiler vendors usually take care of their customers with
compiler switches that enable backwards compatibility.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python
On 2007-02-24, David C Ullrich [EMAIL PROTECTED] wrote:
On 23 Feb 2007 19:13:10 +0100, Neil Cerutti [EMAIL PROTECTED] wrote:
On 2007-02-23, David C Ullrich [EMAIL PROTECTED] wrote:
Is there a csvlib out there somewhere?
And/or does anyone see any problems with
the code below?
[...]
(Um
, 10)
L = [pow(2, -x) for x in L]
%40.40f % mean1(*L)
'0.012109375000'
%40.40f % mean2(*L)
'0.012109375200'
Offhand, I think the first is righter. Weird!
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
'(?:[a-zA-Z]:)')
n = re.compile(r'[\\/]\w+')
m = s.match('c:/tmp/spam/eggs')
n.findall(m.string[m.end():])
['/tmp', '/spam', '/eggs']
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
:
with open(roster_path, 'r') as roster_file,\
open(disb_path, 'w') as out_file,\
open(report_path, 'w') as report_file:
I was thinking about submitting a enhancement request to the
HOWTO, explaining that continuation my be required in this
context. Am I missing anything obvious?
--
Neil
On 2009-11-23, Terry Reedy tjre...@udel.edu wrote:
Neil Cerutti wrote:
Unfortunately, the new nested with statement (which I also read
about today) forces me into this anti-idiom. When replacing an
appearance of contextlib.nested with the 3K with statement, I
ended up with an unexpected
On 2009-11-24, Antoine Pitrou solip...@pitrou.net wrote:
It tries to evaluate the op of the stack (here nonevar) in a
boolean context (which theoretically involves calling
__nonzero__ on the type)
...or __bool__ in Py3K.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python
can do something like:
:set tabstop=4
:set expandtab
:retab
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
])
j += 1
return lst[j][i]
A view should be easier to use and debug than your current
flatten, mutate and unflatten approach.
The above functions obviously make the maximum number of
assumptions about your data structures, and currently don't work
sensibly with negative indices.
--
Neil
.
for (exten, list) in files.iteritems():
with open('extensions-%s.txt' % exten,'w') as f:
f.write('\n'.join(list))
f.write('\n')
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
are unordered in Python.
You'll need to sort them when you need them sorted, or keep a
sorted list separately.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2009-12-07, W. eWatson wolftra...@invalid.com wrote:
See Subject.
def StackImages(self):
self.Upload(P)
self.after_id = self.master.after(1,self.GetFrameOne)
It's a violation of the Law of Demeter.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo
On 2009-12-07, Neil Cerutti ne...@norwich.edu wrote:
On 2009-12-07, W. eWatson wolftra...@invalid.com wrote:
See Subject.
def StackImages(self):
self.Upload(P)
self.after_id = self.master.after(1,self.GetFrameOne)
It's a violation of the Law of Demeter.
Actually
On 2009-12-11, Grant Edwards inva...@invalid.invalid wrote:
[s[1:-1] for s in l if (s[0] == s[-1] == '*')]
That last bit doesn't work right, does it, since an == expression
evaluates to True or False, no the true or false value itself?
--
Neil Cerutti
--
http://mail.python.org/mailman
On 2009-12-11, Grant Edwards inva...@invalid.invalid wrote:
On 2009-12-11, Neil Cerutti ne...@norwich.edu wrote:
On 2009-12-11, Grant Edwards inva...@invalid.invalid wrote:
[s[1:-1] for s in l if (s[0] == s[-1] == '*')]
That last bit doesn't work right, does it, since an == expression
),'logging.cfg'))
__file__ is undefined in your example code, so I'm not getting
the same exception as you.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2009-12-15, Neil Cerutti ne...@norwich.edu wrote:
On 2009-12-15, Peter vm...@mycircuit.org wrote:
on python 2.6 the following code raises an AttributeError:
#!/usr/bin/env python
import os.path as p
import logging, logging.config
class Logger(object):
def load_config(self
language does encourage a certain kind of
code. Good code in one language can be poor in another.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
that
might be useful when you're debugging a program. This is
better:
fname = 'red.txt'
inpf = open(fname, r)
Alternatively:
infile = open(red.txt, r)
infile.name
'red.txt'
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-01-22, Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
On Fri, 22 Jan 2010 13:35:26 +, Neil Cerutti wrote:
On 2010-01-22, Gilles Ganault nos...@nospam.com wrote:
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating
starting position is thus
more fair *and* more efficient. ;)
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
What's the best way to do the inverse operation of the .join
function?
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-06-17, Ian Kelly ian.g.ke...@gmail.com wrote:
On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti
ne...@norwich.edu wrote:
What's the best way to do the inverse operation of the .join
function?
Use the str.split method?
split is perfect except for what happens with an empty string
On 2010-06-17, Robert Kern robert.k...@gmail.com wrote:
On 6/17/10 2:08 PM, Neil Cerutti wrote:
On 2010-06-17, Ian Kellyian.g.ke...@gmail.com wrote:
On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti
ne...@norwich.edu wrote:
What's the best way to do the inverse operation of the .join
function
On 2010-06-18, Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
On Thu, 17 Jun 2010 20:03:42 +, Neil Cerutti wrote:
I'm currently using the following without problems, while
reading a data file. One of the fields is a comma separated
list, and may be empty.
f = rec['codes
!
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
pretty rare that I know the best operations for each bit of
data and how best to bundle that data until after a program is
functional. It is lucky my programs are relatively small. ;)
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
has the most bizarre error message).
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
is involved
in calculations, then the oofun is created to behave like
similar numpy.array attribute.
Telling them, Don't do that, is a good solution in Python.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
A quick web search yielded no current support for the ODBC
interface for Python 3.
I'd like to get a simple tracer bullet up and running ASAP. I
need to connect to an MSSQL database from Windows XP/2000, using
an ODBC interface.
Is this a case where I'll need to go back to Python 2.6?
--
Neil
On 2010-07-21, Tim Golden m...@timgolden.me.uk wrote:
On 21/07/2010 2:15 PM, Neil Cerutti wrote:
A quick web search yielded no current support for the ODBC
interface for Python 3.
I'd like to get a simple tracer bullet up and running ASAP. I
need to connect to an MSSQL database from Windows
On 2010-07-23, Jim jim.heffe...@gmail.com wrote:
How can I calculate how much time is between now and the next
2:30 am? Naturally I want the system to worry about leap
years, etc.
You need the datetime module. Specifically, a datetime and
timedelta object.
--
Neil Cerutti
--
http
()
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
, you'd get a new email containing the
results.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-07-28, Jonathan Hartley tart...@tartley.com wrote:
And Neil Cerutti, I think I'll just email the whole source tree
to myself, and have a script that scans my inbox, unzips source
trees and runs their tests. Much nicer. :-)
Don't forget to clear the screen, though. That ties the whole
program call checkQueue?
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-08-12, Dave Angel da...@ieee.org wrote:
For puzzles:
http://projecteuler.net
...if you like math problems.
http://www.pythonchallenge.com
...if you like fooling around with PIL, graphics and bytes.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
to it if they
aren't used to it already.
I think the main reason zero-based indexing is chosen in higher
level languages is the following useful property:
x[n:m] + x[m:len(x)] == x
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-08-15, John Nagle na...@animats.com wrote:
In retrospect, C's pointer=array concept was a terrible
mistake.
C arrays are not pointers.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
')
The other cases are when indentation levels get the best of me,
but I'm too lazy to refactor.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-08-17, Stefan Schwarzer sschwar...@sschwarzer.net wrote:
Hi Neil,
On 2010-08-17 14:42, Neil Cerutti wrote:
Looking through my code, the split-up lines almost always
include string literals or elimination of meaningless
temporary variables, e.g.:
self.expiration_date
:\\Users\\ZDoor you'd write
rc:\Users\ZDoor (notice the r in front of the string).
That's good general advice. But in the specific case of file
paths, using '/' as the separator is supported, and somewhat
preferable.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
of the new functions are good.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
format (the one in the XML) to another
required format (the one required by another program). There's no
need to guess the format.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
offset.
Because they know deep down they wouldn't win anything.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
.
There was a fling a while ago with typesetting code in
proportional spaced type. I think some of the Effective C++
series from Addison-Wesley did that. Yuck.
It's probably influenced by The C++ Programming Language.
Stroustrup likes it.
--
Neil Cerutti
--
http://mail.python.org/mailman
around Element.find calls, inserting
the namespace.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
to a
loop-style iteration. However, Scheme does tail-call
optimization, I believe, which is slightly more general.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
for these there is ''.join()).
reduce, or functools.reduce in Python 3.1.
functools.reduce(operator.add, ((1, 2), (5, 6)))
(1, 2, 5, 6)
--
Neil Cerutti
It's not fun to build walls. But it's even less fun to live
without walls in a world full of zombies. --Greedy Goblin
--
http://mail.python.org/mailman/listinfo
).
What part of that suggested to you that sum might not be polymorphic?
Sure, it says numbers (which should be changed, in my opinion), but it
doesn't specify what sort of numbers -- ints, floats, or custom types
that have an __add__ method.
WTF.
--
Neil Cerutti
It's not fun to build
caused me a lot more
trouble than switching from 2.5 to 3.1.
Past advice in this forum has been that as long as you don't
depend on libraries that don't yet support Python 3, you can
probably switch over and not need to look back.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python
things in Python. ;)
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
to convert his Pascal to Python, and you'll get to basic parsing
in no time. URL:http://compilers.iecc.com/crenshaw/
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
confused.
I don't agree with that. If a person is trying to ski using
pieces of wood that they carved themselves, I don't expect them
to be surprised that the skis they buy are made out of similar
materials.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-04-11, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Sat, 10 Apr 2010 10:11:07 -0700, Patrick Maupin wrote:
On Apr 10, 11:35??am, Neil Cerutti ne...@norwich.edu wrote:
On 2010-04-10, Patrick Maupin pmau...@gmail.com wrote:
as Pyparsing. ??Which is all well and good
these substrings in
my txt file;
now I don't know how to continue. What is the best way to locate some
string in a file and output them (with print command or in another
file)?
grep
Or: show your work.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
suggesting doesn't save work at all
as you've shown it. There are other ways to do the same thing,
for virtually no work at all.
Don't put big text dumps in your program. Problem solved!
--
Neil Cerutti
*** Your child was bitten by a Bat-Lizard. ***
--
http://mail.python.org/mailman/listinfo
= [lambda: x for x in range(5)]
[f() for f in funs]
[4, 4, 4, 4, 4]
--
Neil Cerutti
*** Your child was bitten by a Bat-Lizard. ***
--
http://mail.python.org/mailman/listinfo/python-list
, enumerate(a))]
b
[1, 2]
--
Neil Cerutti
*** Your child was bitten by a Bat-Lizard. ***
--
http://mail.python.org/mailman/listinfo/python-list
of list comprehension is preferable to my use of filter
posted elsewhere, but it didn't occur to me. Oops!
--
Neil Cerutti
*** Your child was bitten by a Bat-Lizard. ***
--
http://mail.python.org/mailman/listinfo/python-list
, and if there are better solutions
than the ones I'm using ATM.
The first annoyance is when I want to specialize a property in a
subclass.
See:
URI:http://infinitesque.net/articles/2005/enhancing%20Python%27s%20property.xhtml
--
Neil Cerutti
*** You found a dead moose-rat. You sell the hide for $200
( sample ): #if there is a header
colnames = csvfile.next() # label columns from first line
datalist = list( csvfile ) # append data to a list
Do you really need to use the Sniffer? You'll probably be better
off
--
Neil Cerutti
*** You found a dead moose-rat. You sell the hide
On 2010-06-03, Neil Cerutti ne...@norwich.edu wrote:
Do you really need to use the Sniffer? You'll probably be better
off...
...defining your own dialect based on what you know to be the
file format.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible your data is ill-formed in that case? If it's
lacking a line-end, I don't know what should happen.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
logic. Do you have a heuristic
in mind?
You will be better off converting tabbed files to be tabless,
which is pretty easy in vim.
:set expandtab
:set tabstop=N
:retab
N should be whatever value makes the file look right, usually 4
or 8.
--
Neil Cerutti
--
http://mail.python.org/mailman
syntax has non-trivial benefits. It makes a
macro system feasible.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
popular
approach.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
'.format(XMLNS), et al, I can use
find(et, 'ab/cd').
Is there a better ElemenTree based approach I'm missing out on?
And on the other hand, am I circumventing something important, or
inviting bad limitations of some kind?
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
possible while serializing. For debugging, try using
.dump instead. Hopefully that makes the error obvious.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
objects.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
low in surprises. Using if identifier
is one place where you do have to think about unintended
consequences.
Python eschews undefined behavior.
--
Neil Cerutti
What we really can learn from this is that bad accounting can yield
immense imaginary profits. --Klepsacovic
--
http://mail.python.org
On 2011-03-03, Jean-Paul Calderone calderone.jeanp...@gmail.com wrote:
On Mar 3, 8:16?am, Neil Cerutti ne...@norwich.edu wrote:
On 2011-03-03, Tom Zych freethin...@pobox.com wrote:
Carl Banks wrote:
Perl works deterministically and reliably. ?In fact, pretty much every
language works
be a redundant parallel version
of students.keys().
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
refactoring and optimizing.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
from real games, but no better than the average
schmoe when shown randomly positioned pieces. So if everyone
basically follows PEP8 we all benefit from playing by the same
game rules, as it were.
--
Neil Cerutti
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 1188 matches
Mail list logo