Line-continuation "Anti-Idiom" and with statement

2009-11-23 Thread Neil Cerutti
ncement request to the HOWTO, explaining that continuation my be required in this context. Am I missing anything obvious? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Line-continuation "Anti-Idiom" and with statement

2009-11-24 Thread Neil Cerutti
On 2009-11-23, Terry Reedy 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 >&g

Re: pointless musings on performance

2009-11-24 Thread Neil Cerutti
On 2009-11-24, Antoine Pitrou 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-list

Re: sum for sequences?

2010-03-24 Thread Neil Cerutti
excluding strings, since 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

Re: sum for sequences?

2010-03-25 Thread Neil Cerutti
#x27; (which defaults to 0). > > 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. W

Re: Have you embraced Python 3.x yet?

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

Re: another newbie question

2010-11-15 Thread Neil Cerutti
but as a Vim user I can't partake. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to decide between PHP and Python

2011-01-05 Thread Neil Cerutti
se 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
can be a good idea. Python provides inheritance and the NotImplmented exception to help with that. Duck-typing is another popular approach. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Dealing with xml namespaces with ElementTree

2011-01-21 Thread Neil Cerutti
e.g., et.find('{{0}}ab/{{0}}cd'.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
ever 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
On 2011-01-31, Daniel Stender wrote: > Hi guys, > > we are trying to convert a Sanskrit dictionary which is in a > "homegrown" XML format into dict(d), the input file goes like > this: xml.etree.ElementTree will parse your file and return it as a hierarchy of dict-like E

Re: sum for sequences?

2010-04-06 Thread Neil Cerutti
ars* of education and I'll be ready for summing things in Python. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Regular Expressions

2010-04-10 Thread Neil Cerutti
pretty trivial 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
s under the hood, and possibly be very 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 wrote: > On Sat, 10 Apr 2010 10:11:07 -0700, Patrick Maupin wrote: >> On Apr 10, 11:35??am, Neil Cerutti wrote: >>> On 2010-04-10, Patrick Maupin wrote: >>> > as Pyparsing". ??Which is all well and good, except then the

Re: extract substring by regex from a text file

2010-04-15 Thread Neil Cerutti
hese 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
e of your Chevrolet. > The point is, what you're 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

Re: List comprehension + lambdas - strange behaviour

2010-05-07 Thread Neil Cerutti
(Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> funs = [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
d, try filter and enumerate. >>> b = [a for a,b in filter(lambda x: x[1]==3, 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
m in enumerate(a) if item == 3 ] That form 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
r 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

Re: problems with CSV module

2010-06-03 Thread Neil Cerutti
.reader( csvfile, dialect ) Use: csvfile = csv.reader(csvfile, dialect=dialect) dialect is a keyword argument. > if csv.Sniffer().has_header( sample ): #if there is a header > colnames = csvfile.next() # label columns from first line > datalist = list( csvfile ) # append

Re: problems with CSV module

2010-06-03 Thread Neil Cerutti
On 2010-06-03, Neil Cerutti 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
that > line 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
;ll be up to you to program the recognition 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 Cerut

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 wrote: > On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti > 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 strin

Re: The inverse of .join

2010-06-17 Thread Neil Cerutti
On 2010-06-17, Robert Kern wrote: > On 6/17/10 2:08 PM, Neil Cerutti wrote: >> On 2010-06-17, Ian Kelly wrote: >>> On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti >>> wrote: >>>> What's the best way to do the inverse operation of the .join >

Re: The inverse of .join

2010-06-18 Thread Neil Cerutti
On 2010-06-18, Steven D'Aprano wrote: > On Thu, 17 Jun 2010 20:03:42 +0000, 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. >

Re: The inverse of .join

2010-06-18 Thread Neil Cerutti
sv.reader([rec['code1']])) > ['1', '2', '3'] >>>> next(csv.reader([rec['code2']])) > [] Slick! -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Classes

2010-06-24 Thread Neil Cerutti
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
lly odd example of a similar name clash, create a tab separated values file with a header line starting with ID (I get lots of them in my work), and then open it with Excel (I don't know which version 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
t myObject.size 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
o back to Python 2.6? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: An ODBC interface for Python 3?

2010-07-21 Thread Neil Cerutti
On 2010-07-21, Tim Golden 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 c

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

2010-07-23 Thread Neil Cerutti
On 2010-07-23, Jim 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://mail.python.or

Re: string manipulation.

2010-07-27 Thread Neil Cerutti
blem is that the nodeValue stored in the variable 'name' is not "AB" > (what i want) but instead it is a string that has length of 8 and it seems > it include the tabs and/or other things. > How can i get the string "AB" without the other stuff? Check out the strip member function. name = r.childNodes[0].nodeValue.strip() -- 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
Every tme the tests ran, 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 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 who

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

2010-08-05 Thread Neil Cerutti
st) > for i in range(0,self.newPassengers): > self.passengerList.append(self.passengerWaitQ.pop()) > self.goUp() Does your 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 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 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
27;, '%m%d%Y') 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 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.: >> >>

Re: Opposite of split

2010-08-17 Thread Neil Cerutti
' > > If you have backslashes in strings, you might want to use "raw > strings". Instead of "c:\\Users\\ZDoor" you'd write > r"c:\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
ed not obscure the meaning, and may even improve it, *if* the names 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
7;m converting one known 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
> obtain the proper 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
gt; 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/listinfo/python-list

Re: 79 chars or more?

2010-08-20 Thread Neil Cerutti
guments clear. find is just a small wrapper 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
oop-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: Python "why" questions

2010-08-22 Thread Neil Cerutti
On 2010-08-21, Steven D'Aprano wrote: > There is room in the world for programming languages aimed at > non- programmers (although HC is an extreme case), but not all > languages should prefer the intuition of non-programmers over > other values. Extremer: Inform 7. -- Neil

Re: Fibonacci: How to think recursively

2010-09-01 Thread Neil Cerutti
p. def fibi(n): if n < 2: return 1 else: fibminus2 = 1 fibminus1 = 1 i = 2 while i < n: fibminus2, fibminus1 = fibminus1, fibminus2 + fibminus1 i += 1 return fibminus2 + fibminus1 It's interesting that the

Re: That interesting notation used to describe how long a loop will take.

2010-10-04 Thread Neil Cerutti
rticle about this >> subject? I imagine that it has a concise name. >> > It's called the "Big O notation". The web version of the book "Data Structures and Algorithms with Object-Oriented Design Patterns in Python" contains a an explanation in the chapter

Re: Using csv.DictReader with \r\n in the middle of fields

2010-10-13 Thread Neil Cerutti
m.group(6), flags=re.M | re.S) for record in parse_file('45.txt'): print(record) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Neil Cerutti
king with -u option. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Neil Cerutti
t; > By default, Python opens stdin in buffered text mode in which > '\x1A' marks the end of the text. Try adding the "-u" option > ("unbuffered") to Python's command line: > > pythonw.exe -u main.pyw To expound a bit, using a windows-only mod

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Neil Cerutti
ass A: Class B: x = 2 or Class A: Class B: def __init__(self): self.x = 2 -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Neil Cerutti
On 2010-10-18, Neil Cerutti wrote: > On 2010-10-18, > wrote: >> Hello. >> >> I have a class A that contains two classes B and C: >> >> class A: >> class B: >> self.x = 2 >> >> class C: >> >> Is there a way to

Re: how to scrutch a dict()

2010-10-21 Thread Neil Cerutti
ad to cirrhossis of the dictionary. Here's another idea: for k in [k for k, v in d.items() if v is None]: del d[k] -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Neil Cerutti
t; ... > ... > yCoordinate += 1 _The Practice of Programming_ has this right. In general the bigger the scope of a variable, the longer and more descriptive should be its name. In a small scope, a big name is mostly noise. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Neil Cerutti
ented in your module, should be included. Beginner mistakes like, "define a class to model birds," and, "# increment the total," are worse than empty space. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changes

2010-10-28 Thread Neil Cerutti
n years ago puts around the time of Python 2.1. Your books are indeed useless. Python's documentation contains an excellent summary of new features and changes dating back to Python 2.0. http://docs.python.org/py3k/whatsnew/index.html -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-01 Thread Neil Cerutti
On 2010-11-01, Martin v. Loewis wrote: > i.e. avoid the backslash for multi-line conditions altogether > (in fact, I can't think any situation where I would use the > backslash). The horrible-to-nest with statement. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: playful coding problems for 10 year olds

2010-11-02 Thread Neil Cerutti
lems, which I think is quite nice. possessive,is_palindrom, pig_latin, and so forth might make good Python exercises, too. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-03 Thread Neil Cerutti
s in columns is just as bad. Code should be utilitarian rather than ornate, Shaker rather than Victorian. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-04 Thread Neil Cerutti
ine. The handsome ':' terminator of if/elif/if statements allows us to omit a newline, conserving vertical space. This improves the readability of certain constructs. if x: print(x) elif y: print(y) else: print() versus if x print(x) elif y print(y) else print() Beauty-is-in-the-eye-of-the-BDFLly-yours, -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-04 Thread Neil Cerutti
lly. Auto-indent is fairly easy in Python. Auto-dedent is the impossible part. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-04 Thread Neil Cerutti
On 2010-11-04, Grant Edwards wrote: > On 2010-11-04, Neil Cerutti wrote: >> On 2010-11-04, D'Arcy J.M. Cain wrote: >>>> * Not being able to write an auto-indenter, ever, because it >>>> is by design theoretically impossible: Annoying. >>> >>

Re: What is the best way to handle a missing newline in the following case

2010-11-05 Thread Neil Cerutti
g a list. Just do > > with open(r'c:\test.txt') as f: >for l in f: >print int(l) > > As long as you just have digits and whitespace then that's fine > - int() will do as you want. Keep in mind that a file that a text file that doesn't end with a newline isn't strictly legal. You can expect problems, or at least warnings, with other tools with such files. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-08 Thread Neil Cerutti
t;, MainWindow.ColorsHighlightedList), ("selected", "select", MainWindow.ColorsSelectedList)] Moreover, I jump the gun early on tables like this. styles = [csv.reader(open("styles.csv", newlines=''))] Maybe too early. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-08 Thread Neil Cerutti
On 2010-11-07, Lawrence D'Oliveiro wrote: > In message <8jftftfel...@mid.individual.net>, Neil Cerutti wrote: > >> The handsome ':' terminator of if/elif/if statements allows us to >> omit a newline, conserving vertical space. This improves the >> r

Re: Compare source code

2010-11-09 Thread Neil Cerutti
ave different settings, >> and they will see different indentations for your code > > That's exactly the point -- each person can decide what level > of indentation they prefer to look at. That ideal works only if you are disciplined to never mix tabs and spaces. "Wrapped"

Re: is there an Python equivalent for the PHP super globals like $_POST, $_COOKIE ?

2010-11-12 Thread Neil Cerutti
tten in Python. > > "The determined Real Programmer can write Fortran programs in > any language." They probably won't run quite as as fast, though. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store properties

2017-02-08 Thread Neil Cerutti
>> used. > > I use it a lot ;-) Me too. I wrote a script once to convert all my .cfg files to JSON at one point while trying out a switch from Python to Go, but never made the changeover. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Neil Cerutti
mn-names portion of an INSERT statement. quoted_val, = c.execute("SELECT quote(?);", (val,)).fetchone() -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: "pandas" pronunciation

2017-04-05 Thread Neil Cerutti
On 2017-04-03, Jay Braun wrote: > I hear people say it like the plural of "panda", and others as > "panduss". Is there a correct way? I think it is pronounced like the regular word. The second a is schwa in both the singular and plural. -- Neil Cerutti -- https

Re: [OT] How to improve my programming skills?

2017-06-01 Thread Neil Cerutti
that concentrates on functional programming with immutable state if you haven't done it before. The book that worked for me was Simply Scheme https://people.eecs.berkeley.edu/~bh/ss-toc2.html, but that's sorta ancient history now and I'm sure there's lots more options out there. --

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Neil Cerutti
ands from different levels of abstraction, e.g., only call 'commit' directly if you called 'begin' directly. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Neil Cerutti
On 2017-06-02, Dennis Lee Bieber wrote: > > A bit of a long free-association rambling... > > On Fri, 2 Jun 2017 12:07:45 + (UTC), Neil Cerutti > declaimed the following: >>You're probably not expected to interleave transaction control >>commands from

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Neil Cerutti
at the > module, connection and cursor levels. You get autocommit with sqlite3 by setting isolation_level=None on the connection object. https://docs.python.org/2/library/sqlite3.html#sqlite3-controlling-transactions -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Namedtuple problem #32.11.d

2017-06-06 Thread Neil Cerutti
this point, after only one bad experience trying to work around my choice of container. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Namedtuple problem #32.11.d

2017-06-07 Thread Neil Cerutti
nd illuminate dark corners of both my own skill and Python's features. An Excel spreadsheet that represents a table of data is fairly simple to map onto a Python dict. One nearly codeless way is to export it from Excel as a csv file and then read it with csv.DictReader. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to ensure user calls methods in correct order?

2017-06-23 Thread Neil Cerutti
ect that has the methods that should only be > called for active connections. That way it's not possible to do > things out of sequence. It's like a bidirectional iterator in C++, except in reverse it's random access. An iterator that can't easily be modeled with a generato

Re: Grapheme clusters, a.k.a.real characters

2017-07-14 Thread Neil Cerutti
s separate API's that allow you to regard those bytes as either plain old bytes, or as a sequence of runes (not-necessarily normalized codepoints). If your bytes strings aren't in UTF-8, then Go Away. https://blog.golang.org/strings -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Code for addition

2017-08-07 Thread Neil Cerutti
33) / 2 You could also calculate it with a combination of sum and range builtins, as others have hinted, and if it's homework that's probably a good idea. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

<    7   8   9   10   11   12