Re: searching a list of lists as a two-dimensional array?

2007-02-12 Thread Neil Cerutti
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

Re: Vim scripting with python

2007-02-12 Thread Neil Cerutti
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

Re: c++ for python programmers

2007-02-13 Thread Neil Cerutti
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

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread Neil Cerutti
/ -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: float print formatting

2007-02-13 Thread Neil Cerutti
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

Re: float print formatting

2007-02-13 Thread Neil Cerutti
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

Re: c++ for python programmers

2007-02-14 Thread Neil Cerutti
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

Re: Recursive calls and stack

2007-02-14 Thread 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

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Neil Cerutti
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

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Neil Cerutti
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

Re: c++ for python programmers

2007-02-14 Thread Neil Cerutti
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

Re: f---ing typechecking

2007-02-15 Thread Neil Cerutti
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

Re: f---ing typechecking

2007-02-15 Thread Neil Cerutti
. 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

Re: Method overloading?

2007-02-15 Thread Neil Cerutti
. What Python provides is dynamic polymorphism of names with single-dispatch. I think. ;-) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive calls and stack

2007-02-15 Thread Neil Cerutti
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

Re: multiple inheritance of a dynamic list of classes?

2007-02-15 Thread Neil Cerutti
): ... 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

Re: Recursive calls and stack

2007-02-15 Thread Neil Cerutti
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

Re: Recursive calls and stack

2007-02-15 Thread Neil Cerutti
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

Re: why I don't like range/xrange

2007-02-16 Thread Neil Cerutti
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

Re: Help Required for Choosing Programming Language

2007-02-16 Thread Neil Cerutti
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

Re: eval('000052') = 42?

2007-02-21 Thread Neil Cerutti
, 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

Re: f---ing typechecking

2007-02-21 Thread Neil Cerutti
-starts with a manual transmission, but not with an automatic transmission. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert to binary and convert back to strings

2007-02-22 Thread Neil Cerutti
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

Re: CSV(???)

2007-02-23 Thread Neil Cerutti
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

Re: Pep 3105: the end of print?

2007-02-26 Thread Neil Cerutti
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

Re: CSV(???)

2007-02-26 Thread Neil Cerutti
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

Re: Lists: Converting Double to Single

2007-02-27 Thread Neil Cerutti
, 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

Re: Regexp and multiple groups (with repeats)

2009-11-20 Thread Neil Cerutti
'(?:[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

Line-continuation Anti-Idiom and with statement

2009-11-23 Thread Neil Cerutti
: 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

Re: Line-continuation Anti-Idiom and with statement

2009-11-24 Thread Neil Cerutti
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

Re: pointless musings on performance

2009-11-24 Thread Neil Cerutti
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

Re: how to format a python source file with tools?

2009-11-30 Thread Neil Cerutti
can do something like: :set tabstop=4 :set expandtab :retab -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: flattening and rebuilding a simple list of lists

2009-11-30 Thread Neil Cerutti
]) 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

Re: slightly OT: Python BootCamp

2009-12-04 Thread Neil Cerutti
. 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

Re: More elegant solution for diffing two sequences

2009-12-04 Thread Neil Cerutti
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

Re: What is the significance of after() in this code?

2009-12-07 Thread Neil Cerutti
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

Re: What is the significance of after() in this code?

2009-12-07 Thread Neil Cerutti
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

Re: a list/re problem

2009-12-12 Thread Neil Cerutti
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

Re: a list/re problem

2009-12-15 Thread Neil Cerutti
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

Re: AttributeError: logging module bug ?

2009-12-15 Thread Neil Cerutti
),'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

Re: AttributeError: logging module bug ?

2009-12-15 Thread Neil Cerutti
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

Re: Object Relational Mappers are evil (a meditation)

2009-12-17 Thread Neil Cerutti
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

Re: Dynamic text color

2010-01-06 Thread Neil Cerutti
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

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Neil Cerutti
. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Neil Cerutti
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

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Neil Cerutti
starting position is thus more fair *and* more efficient. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

The inverse of .join

2010-06-17 Thread Neil Cerutti
What's the best way to do the inverse operation of the .join function? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: The inverse of .join

2010-06-17 Thread Neil Cerutti
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

Re: The inverse of .join

2010-06-17 Thread Neil Cerutti
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

Re: The inverse of .join

2010-06-18 Thread Neil Cerutti
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

Re: The inverse of .join

2010-06-18 Thread Neil Cerutti
! -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Classes

2010-06-24 Thread Neil Cerutti
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

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-13 Thread Neil Cerutti
has the most bizarre error message). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: hasattr + __getattr__: I think this is Python bug

2010-07-20 Thread Neil Cerutti
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

An ODBC interface for Python 3?

2010-07-21 Thread Neil Cerutti
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

Re: An ODBC interface for Python 3?

2010-07-21 Thread Neil Cerutti
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

Re: time between now and the next 2:30 am?

2010-07-23 Thread Neil Cerutti
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

Re: string manipulation.

2010-07-27 Thread Neil Cerutti
() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Neil Cerutti
, you'd get a new email containing the results. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-28 Thread Neil Cerutti
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

Re: new to python - trouble calling a function from another function

2010-08-05 Thread Neil Cerutti
program call checkQueue? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Puzzles? What's your favorite puzzle?

2010-08-12 Thread Neil Cerutti
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

Re: Python why questions

2010-08-13 Thread Neil Cerutti
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

Re: Python why questions

2010-08-16 Thread Neil Cerutti
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

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
') 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

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
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

Re: Opposite of split

2010-08-17 Thread Neil Cerutti
:\\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

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
of the new functions are good. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-18 Thread Neil Cerutti
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

Re: Python why questions

2010-08-19 Thread Neil Cerutti
offset. Because they know deep down they wouldn't win anything. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-20 Thread Neil Cerutti
. 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

Re: 79 chars or more?

2010-08-20 Thread Neil Cerutti
around Element.find calls, inserting the namespace. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-20 Thread Neil Cerutti
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

Re: sum for sequences?

2010-03-24 Thread Neil Cerutti
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

Re: sum for sequences?

2010-03-25 Thread Neil Cerutti
). 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

Re: Have you embraced Python 3.x yet?

2010-03-26 Thread Neil Cerutti
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

Re: sum for sequences?

2010-04-06 Thread Neil Cerutti
things in Python. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Regular Expressions

2010-04-10 Thread Neil Cerutti
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

Re: Python and Regular Expressions

2010-04-10 Thread Neil Cerutti
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

Re: Python and Regular Expressions

2010-04-12 Thread Neil Cerutti
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

Re: extract substring by regex from a text file

2010-04-15 Thread Neil Cerutti
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

Re: assigning multi-line strings to variables

2010-04-30 Thread Neil Cerutti
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

Re: List comprehension + lambdas - strange behaviour

2010-05-07 Thread Neil Cerutti
= [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

Re: indexing lists/arrays question

2010-05-13 Thread Neil Cerutti
, enumerate(a))] b [1, 2] -- Neil Cerutti *** Your child was bitten by a Bat-Lizard. *** -- http://mail.python.org/mailman/listinfo/python-list

Re: indexing lists/arrays question

2010-05-13 Thread Neil Cerutti
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

Re: Minor annoyances with properties

2010-05-27 Thread Neil Cerutti
, 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

Re: problems with CSV module

2010-06-03 Thread Neil Cerutti
( 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

Re: problems with CSV module

2010-06-03 Thread Neil Cerutti
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

Re: problems with CSV module

2010-06-03 Thread Neil Cerutti
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

Re: Python + vim + spaces vs tab

2010-06-07 Thread Neil Cerutti
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

Re: Trying to decide between PHP and Python

2011-01-05 Thread Neil Cerutti
syntax has non-trivial benefits. It makes a macro system feasible. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Which coding style is better? public API or private method inside class definition

2011-01-05 Thread Neil Cerutti
popular approach. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Dealing with xml namespaces with ElementTree

2011-01-21 Thread Neil Cerutti
'.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

Re: lxml.etree, namespaces and element insertion

2011-01-27 Thread Neil Cerutti
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

Re: XML to dict(d)

2011-01-31 Thread Neil Cerutti
objects. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking against NULL will be eliminated?

2011-03-03 Thread Neil Cerutti
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

Re: Checking against NULL will be eliminated?

2011-03-03 Thread Neil Cerutti
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

Re: Python 3: dict dict.keys()

2013-07-24 Thread Neil Cerutti
be a redundant parallel version of students.keys(). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: import syntax

2013-07-30 Thread Neil Cerutti
refactoring and optimizing. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-30 Thread Neil Cerutti
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

<    2   3   4   5   6   7   8   9   10   11   >