Re: The best, friendly and easy use Python Editor.

2013-01-25 Thread Neil Cerutti
never blames > the tools. ;) DOS Edit was great for quick edits. The file size limit is a pity, though. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Distributing methods of a class across multiple files

2012-01-25 Thread Neil Cerutti
three solutions Steven presented, the latter two leave very strong coupling between the code in your separate files. This makes working with the files independently impractical. Stick with mixin classes and pay heed to the Law of Demeter if you want to de-couple them enough to work on inde

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread Neil Cerutti
ink XYZ is easy". Furthermore, if you insist on > QUANTIFYING a QUANTIFIER, simply use any number of legal > QUANTIFIERS. "I think XYZ is VERY easy" or "I think XYZ is > SOMEWHAT easy" or "I think XYZ is difficult". I remind you of http://orwell.ru/library/es

Re: PyPI - how do you pronounce it?

2012-01-30 Thread Neil Cerutti
ritish pronunciation of Beauchamp created a minor incident at Yeoman of the Guard auditions this weekend. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PyPI - how do you pronounce it?

2012-01-30 Thread Neil Cerutti
On 2012-01-30, Chris Angelico wrote: > On Mon, Jan 30, 2012 at 11:12 PM, Neil Cerutti wrote: >> >> The British pronunciation of Beauchamp created a minor incident >> at Yeoman of the Guard auditions this weekend. > > What about Sir Richard "Chumley&qu

Re: Cycle around a sequence

2012-02-08 Thread Neil Cerutti
in rotated(range(5), 3)) '3, 4, 0, 1, 2' """ i = n - len(seq) while i < n: yield seq[i] i += 1 if __name__ == "__main__": import doctest doctest.testmod() If you have merely an iterable instead of a sequence, then lo

Re: Formate a number with commas

2012-02-09 Thread Neil Cerutti
> '2,348,721' > > I'm a perpetual novice, so just looking for better, slicker, > more proper, pythonic ways to do this. I think you've found an excellent way to do it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Undoing character read from file

2012-02-17 Thread Neil Cerutti
ength buffer instead, with n being the maximum number of characters you'd like to be able to put back. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-24 Thread Neil Cerutti
d that constant will ALWAYS be larger! What's the point of that? The only time I've naively pined for such a thing is when misapplying C idioms for finding a minimum value. Python provides an excellent min implementation to use instead. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-27 Thread Neil Cerutti
A truncated string with a maxlength of INFINITY is just a string. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: "Decoding unicode is not supported" in unusual situation

2012-03-09 Thread Neil Cerutti
erhaps encode and then decode, rather than try to encode a non-encoded str. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Software Engineer -

2012-03-13 Thread Neil Cerutti
where reader not looking for jobs have to delete them. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-16 Thread Neil Cerutti
ingly random way in which we apply articles to our nouns. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-16 Thread Neil Cerutti
ding instructions. A sequence of > instructions is an algorithm, program or routine. You may have > heard of them :) A grammarian always uses complete sentence before a colon, even when introducing a list. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-16 Thread Neil Cerutti
mmatical rules used by > people in real life. You know the ones: linguists. My mistake. I am not pedantic. You are wrong. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:53:24 +0000, Neil Cerutti wrote: > >> On 2012-03-16, Steven D'Aprano >> wrote: >>> Ah, perhaps you're talking about *prescriptivist* grammarians, who >>> insist on applying grammat

Re: Python is readable

2012-03-19 Thread Neil Cerutti
On 2012-03-17, Terry Reedy wrote: > On 3/16/2012 9:08 AM, Neil Cerutti wrote: > >> A grammarian always uses complete sentence before a colon, even >> when introducing a list. > > The Chicago Manual of Style*, 13th edition, says "The colon is > used to mar

Re: Python is readable

2012-03-19 Thread Neil Cerutti
On 2012-03-19, Steven D'Aprano wrote: > On Mon, 19 Mar 2012 11:26:10 +0000, Neil Cerutti wrote: > [...] >>> *A major style guide for general American writing and >>> publication: used by some as the 'Bible'. >> >> Thanks for the discussion and

A debugging story.

2012-03-19 Thread Neil Cerutti
seconds. This message brought to you by the Debugging is Mostly Comprehending Old Code and Testing Council. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing the files by last modified time

2012-03-22 Thread Neil Cerutti
type of fromtimestamp are really the same or not. I guess I came to that conclusion some time in the past, and it does seem to work. It may be a simple case of just different aspects the exact same type being being highlighted in each definition. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Neil Cerutti
say what it would be in an imaginary > hypothetical implementation doesn't mean I can never say > anything about it. I am in a similar situation viz a viz my wife's undergarments. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-30 Thread Neil Cerutti
Inform 6 code. I never thought too deeply about why I disliked it, assuming it was because I already knew Inform 6. Would you like to write the equivalent, e.g., C code in English? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-04-03 Thread Neil Cerutti
't reasonably do low quantities. I worked on a system where the main interface to the system was poking and peeking numbers at memory addresses. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: ordering with duck typing in 3.1

2012-04-09 Thread Neil Cerutti
On 2012-04-07, Jon Clements wrote: > Any reason you can't derive from int instead of object? You may > also want to check out functions.total_ordering on 2.7+ functools.total_ordering I was temporarily tripped up by the aforementioned documentation, myself. -- Neil Cerut

Re: Python Gotcha's?

2012-04-09 Thread Neil Cerutti
. In the case of 2 to 3, more help and support than usual is available: http://docs.python.org/dev/howto/pyporting.html -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Framework for a beginner

2012-04-19 Thread Neil Cerutti
hat advice, it is not meant to make your code better, but to increase your code's fidelity within the Python community. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

csv: No fields, or one field?

2012-04-25 Thread Neil Cerutti
#x27;]). This is surprising given the definition of QUOTE_MINIMAL, which fails to mention this special case. csv.QUOTE_MINIMAL Instructs writer objects to only quote those fields which contain special characters such as delimiter, quotechar or any of the characters in lineterminator. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: csv: No fields, or one field?

2012-04-25 Thread Neil Cerutti
On 2012-04-25, Kiuhnm wrote: > On 4/25/2012 20:05, Neil Cerutti wrote: >> Is there an explanation or previous dicussion somewhere for the >> following behavior? I haven't yet trolled the csv mailing list >> archive, though that would probably be a good place to check. &

Re: csv: No fields, or one field?

2012-04-26 Thread Neil Cerutti
On 2012-04-26, Tim Roberts wrote: > Neil Cerutti wrote: > >>Is there an explanation or previous dicussion somewhere for the >>following behavior? I haven't yet trolled the csv mailing list >>archive, though that would probably be a good place to check. >> >&

Re: csv: No fields, or one field?

2012-04-26 Thread Neil Cerutti
On 2012-04-26, Neil Cerutti wrote: > I made the following wrong assumption about the csv EBNF > recognized by Python (ignoring record seps): > > record -> field {delim field} > > There's at least some csv "standard" documents requirin

Re: how to avoid leading white spaces

2011-06-02 Thread Neil Cerutti
ods, when they're sufficent, are usually more efficient. Perl integrated regular expressions, while Python relegated them to a library. There are thus a large class of problems that are best solve with regular expressions in Perl, but str methods in Python. -- Neil Cerutti -- http://m

Re: how to avoid leading white spaces

2011-06-03 Thread Neil Cerutti
27;s clunky enough that it does contribute to making it my last resort. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: how to avoid leading white spaces

2011-06-03 Thread Neil Cerutti
le react to that >> misuse by treating any use of regexes with suspicion. > > So you claim. I have seen more postings in here where > REs were not used when they would have simplified the code, > then I have seen regexes used when a string method or two > would have done the same thing. Can you find an example or invent one? I simply don't remember such problems coming up, but I admit it's possible. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: how to avoid leading white spaces

2011-06-06 Thread Neil Cerutti
On 2011-06-06, ru...@yahoo.com wrote: > On 06/03/2011 02:49 PM, Neil Cerutti wrote: > Can you find an example or invent one? I simply don't remember > such problems coming up, but I admit it's possible. > > Sure, the response to the OP of this thread. Here's a r

Re: how to avoid leading white spaces

2011-06-06 Thread Neil Cerutti
On 2011-06-06, Ian Kelly wrote: > On Mon, Jun 6, 2011 at 10:08 AM, Neil Cerutti wrote: >> import re >> >> print("re solution") >> with open("data.txt") as f: >> ? ?for line in f: >> ? ? ? ?fixed = re.sub(r"(TABLE='\S+)\s

Re: how to avoid leading white spaces

2011-06-06 Thread Neil Cerutti
med if it did, that the quotes are supposed to be there. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Function call arguments in stack trace?

2011-06-07 Thread Neil Cerutti
tion, then instead of: > > Traceback (most recent call last): > File "bar.py", line 123, in foo > build_rpms() > > The stack trace would read: > > Traceback (most recent call last): > File "bar.py", line 123, in foo(1, [2]) > build_

Re: Function call arguments in stack trace?

2011-06-07 Thread Neil Cerutti
On 2011-06-07, Dun Peal wrote: > On Jun 7, 1:23?pm, Neil Cerutti wrote: >> Use pdb. > > Neil, thanks for the tip; `pdb` is indeed a great debugging > tool. > > Still, it doesn't obviate the need for arguments in the stack > trace. For example: > > 1) A

Re: Python Regular Expressions

2011-06-22 Thread Neil Cerutti
robust than modifying the csv entries in place. It decouples deciphering the meaning of the data from emitting the data, which is more robust and expansable. The amount of ingenuity required is less, though. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Neil Cerutti
On 2011-07-06, Chris Angelico wrote: > On Wed, Jul 6, 2011 at 11:41 PM, rantingrick > wrote: >> Give it up man and admit i am correct and you are wrong. > > Sorry. A Lawful Good character cannot tell a lie. Lawful Good characters have a hard time coexisting with the Chaotic N

Re: Lisp refactoring puzzle

2011-07-12 Thread Neil Cerutti
t in lisps. > > In Common Lisp you have: > > CL-USER> (union '(a b c) '(b c d)) > (A B C D) > CL-USER> (intersection '(a b c) '(b c d)) > (C B) What's the rationale for providing them? Are the definitions obvious for collections that a not sets? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Neil Cerutti
*-<##>-**-<## # The temptation to make code look cutesy # # and ornate is a huge time-waster if# # you let it get the best of you. # ##>-**-<##>-**-<##>-**-<##>-**-<##>-**-<##>-**-<##>-**-<##>-**-<## -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-22 Thread Neil Cerutti
on that leading white space is important for code formatting, but that all alignment after that is unimportant. Peek at Stroustrup's writing for examples. It really doesn't take much time at all to get used to it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-22 Thread Neil Cerutti
On 2011-07-22, Ian Kelly wrote: > On Fri, Jul 22, 2011 at 6:59 AM, Neil Cerutti wrote: >> Under the assumption that leading white space is important for >> code formatting, but that all alignment after that is >> unimportant. > > ...unless you're trying to adh

Re: PEP 8 and extraneous whitespace

2011-07-22 Thread Neil Cerutti
On 2011-07-22, John Gordon wrote: > In <98u00kfnf...@mid.individual.net> Neil Cerutti writes: >> You can fit much more code per unit of horizontal space with a >> proportionally spaced font. As a result, that issue, while >> valid, is significantly reduced. > >

Re: PEP 8 and extraneous whitespace

2011-07-25 Thread Neil Cerutti
st people don't have enough time to write that little. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Is this overuse a context manager?

2011-07-26 Thread Neil Cerutti
more carefully about how long I really need that resource. But maybe I'm being a bit zeallous. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension to do os.path.split_all ?

2011-07-28 Thread Neil Cerutti
be a way to use them for an elegant > solution of my problem. I can't quite work it out. Any > brilliant ideas? (or other elegant solutions to the problem?) If an elegant solution doesn't occur to me right away, then I first compose the most obvious solution I can think of.

Re: list comprehension to do os.path.split_all ?

2011-07-29 Thread Neil Cerutti
>>> split_path('smith/jones') ['smith', 'jones'] >>> split_path('') [] >>> p = split_path('/') >>> p[0] == os.path.sep True >>> len(p) 1 """ head, tail = os.path.split(path) retval = [] while tail != '': retval.append(tail) head, tail = os.path.split(head) else: if os.path.isabs(path): retval.append(os.path.sep) return list(reversed(retval)) if __name__ == '__main__': import doctest doctest.testmod() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: allow line break at operators

2011-08-11 Thread Neil Cerutti
the braces shouldn't matter. No, the braces shouldn't matter, (Matter, matter, matter, matter) No, the braces shouldn't matter, (Matter, matter, matter, matter) When delineating code-clocks, with my keys a-clitter-clatter, I prefer semantic whitespace 'cause the braces shouldn't matter. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: allow line break at operators

2011-08-12 Thread Neil Cerutti
think of is *very* early Fortran, and > that rightly is considered a mistake. Early versions of Basic were like this, too. It was common to compress large C64 Basic programs by removing the spaces and substituting the command synonyms. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten rules to becoming a Python community member.

2011-08-15 Thread Neil Cerutti
lls for extra credit? >> >> Greetings from a Dutchman! No credit. E.g., i.e., exampla gratis, means, "for example." -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten rules to becoming a Python community member.

2011-08-15 Thread Neil Cerutti
On 2011-08-15, MRAB wrote: > On 15/08/2011 17:18, Lucio Santi wrote: >> On Mon, Aug 15, 2011 at 9:06 AM, Neil Cerutti > <mailto:ne...@norwich.edu>> wrote: >> >> On 2011-08-14, Chris Angelico > <mailto:ros...@gmail.com>> wrote: >>

Re: testing if a list contains a sublist

2011-08-16 Thread Neil Cerutti
, [1, 2]) False >>> is_subseq_of(['1,2', '3,4'], [1, 2, 3, 4]) False """ x = tuple(x) ix = 0 lenx = len(x) if lenx == 0: return True for elem in y: if x[ix] == elem: ix += 1 else: ix = 0 if ix == lenx: return True return False if __name__ == '__main__': import doctest doctest.testmod() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimizing Text Similarity Algorithm

2011-08-22 Thread Neil Cerutti
r opinion about >> the thing I am doing is acceptable, or are there some expects of it that >> could change. Perhaps check out difflib.SequenceMatcher.ratio to see if the library function is good enough. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-29 Thread Neil Cerutti
believe the length of a name should usually be proportional to the scope of the object it represents. In my house, I'm dad. In my chorus, I'm Neil. In town I'm Neil Cerutti, and in the global scope I have to use a meaningless unique identifier. Hopefully no Python namespace ever gets that big. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-29 Thread Neil Cerutti
On 2011-08-29, Chris Angelico wrote: >> In my house, I'm dad. In my chorus, I'm Neil. In town I'm Neil >> Cerutti, and in the global scope I have to use a meaningless >> unique identifier. Hopefully no Python namespace ever gets that >> big. > >

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Neil Cerutti
/docs.python.org/faq/design.html#why-self -- Neil Cerutti "A politician is an arse upon which everyone has sat except a man." e. e. cummings -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking against NULL will be eliminated?

2011-03-03 Thread Neil Cerutti
gt; Python is generally low in surprises. Using "if " > 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

Re: Checking against NULL will be eliminated?

2011-03-03 Thread Neil Cerutti
On 2011-03-03, Jean-Paul Calderone wrote: > On Mar 3, 8:16?am, Neil Cerutti wrote: >> On 2011-03-03, Tom Zych wrote: >> >> > Carl Banks wrote: >> >> Perl works deterministically and reliably. ?In fact, pretty much every >> >> language works det

Re: value of pi and 22/7

2011-03-18 Thread Neil Cerutti
. End Of. RIIght. What's a cubit? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2011-03-18 Thread Neil Cerutti
On 2011-03-18, Stefan Behnel wrote: > Neil Cerutti, 18.03.2011 13:17: >> On 2011-03-18, peter wrote: >>> The Old Testament (1 Kings 7,23) says ... "And he made a molten >>> sea, ten cubits from the one brim to the other: it was round >>> all about, and

Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-05 Thread Neil Cerutti
book, especially, does not cover issues relating to large scale software development. As for factoring out re.compile, I believe they are cached by the re module, so you would save the cost of retrieving the cached regex, but not the cost of building it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard config file format

2011-04-06 Thread Neil Cerutti
discovered a bug in a large config file that's been there for seven years. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: fighting game made with python

2011-04-07 Thread Neil Cerutti
some, I'd like to know too I won't play them of > course, ... just would be interesting to know that Python is so > versatile. Python would b ea bad choice for most of any fighting game, but could see use as a configuration or internal scripting engine. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread Neil Cerutti
ns didn't already create. Were context managers in existence at the time? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread Neil Cerutti
On 2011-04-12, Neil Cerutti wrote: > On 2011-04-12, Ian Kelly wrote: >> Flow-control macros were suggested as part of PEP 343, but >> they were rejected by Guido based on this rant: >> >> http://blogs.msdn.com/b/oldnewthing/archive/2005/01/06/347666.aspx > >

Re: Groups in regular expressions don't repeat as expected

2011-04-20 Thread Neil Cerutti
, it returns only the > last one. > > The documentation in fact says that, at > > http://docs.python.org/library/re.html > > "If a group is contained in a part of the pattern that matched multiple > times, the last match is returned." > > That's kind of lame, though. I'd expect that there would be some way > to retrieve all matches. .findall -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Groups in regular expressions don't repeat as expected

2011-04-21 Thread Neil Cerutti
= re.match(r"^[a-z]+$", s) >>> if m: ... print(re.findall(r"[a-z]", m.group())) ... ['a', 'b', 'c', 'd', 'e', 'f'] I can see that getting really annoying. Is there a better way to make multiple group matches accessible without adding a third element type as a group element? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree XML parsing problem

2011-04-27 Thread Neil Cerutti
claring an XMLParser. import xml.etree.ElementTree as etree with open('file.xml') as xml_file: parser = etree.XMLParser(encoding='ISO-8859-1') root = etree.parse(xml_file, parser=parser).getroot() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-05 Thread Neil Cerutti
ugh the "is" operator. > Arguably, it should not be. But that's the sole purpose of the is operator. You either expose those details, or you don't have an is operator at all. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-05 Thread Neil Cerutti
On 2011-05-05, Roy Smith wrote: > Of course, C++ lets you go off the deep end with abominations > like references to pointers. Come to think of it, C++ let's > you go off the deep end in so many ways... But you can do some really cool stuff in the deep end. -- Neil Ce

Re: What other languages use the same data model as Python?

2011-05-05 Thread Neil Cerutti
ll the decorated function, with no special syntax required. C pointers don't automatically dereference themselves. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-06 Thread Neil Cerutti
pe pattern (an interface class containing a pointer to an implementation) with template classes to create type-safe polymorphic types with specializable, decoupled implementations. A Python programmer just feels depressed that anyone could have a need for such innovations, though. ;) -- Neil Cerutti --

Re: string formatting

2011-05-06 Thread Neil Cerutti
se complex formating declarations. For simple constructs there's not much difference between them, but if you switch to .format you'll probably reap some benefit. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing a graph image

2011-05-13 Thread Neil Cerutti
this with PIL http://www.pythonware.com/products/pil/>. The technique is necessary in The Python Challenge, for example. http://www.pythonchallenge.com/> -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-26 Thread Neil Cerutti
than just its author. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: The worth of comments

2011-05-31 Thread Neil Cerutti
t's > supposed to do (even if it's not the best way to do it). That's an excellent illustration of bad code hid by a bad comment. Perhaps better: def foo(): raise IndexError() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Neil Cerutti
ython's argument passing for non-Python programmers strikes me as a sincere effort to to simplify something that just isn't simple. If calling it, "pass by assignment," is admitting defeat, then so be it. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python scripting as side job

2017-09-26 Thread Neil Cerutti
east on one side of the pipeline. Some experience in the industry you want to script for will really be required, even in such simple cases. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

OT: Drain specialist Was: Beginners and experts

2017-09-28 Thread Neil Cerutti
o configure your email server--it isn't that he or she *can't* do it... -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Beginners and experts (Batchelder blog post)

2017-09-28 Thread Neil Cerutti
of them are good at explaining what they know in a comprehensible and entertaining way. I believe you will benefit from and even enjoy some of the literature. Here's a recent favorite: "The Pragmatic Programmer", Andrew Hunt and David Thomas. ISBN-13: 978-0201616224 -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: The "loop and a half"

2017-10-04 Thread Neil Cerutti
insist they understand the iterator protocol and exception handling first they're bound to think iteration is a hovercraft full of eels. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Easier way to do this?

2017-10-05 Thread Neil Cerutti
job using a pivot table in Excel. Office manager, learn thy Excel! On the other hand, I think Python's csv module is a killer app, so I do recommend taking the opportunity to learn csv.DictReader and csv.DictWriter for your own enjoyment. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Pedagogical style [was Re: The "loop and a half"]

2017-10-06 Thread Neil Cerutti
thinking about and asking questions about Python has been of great interest to me, and provided entertainment and enlightenment. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Neil Cerutti
+ is easy to overcomplicate with the multiple inheritance feature. Alternatives are almost always preferable. Some people also appreciate C++'s improvements upon C's type sytem enough to compile all their C programs with C++. I dig const qualifiers, even though I'm comletely fine wit

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Neil Cerutti
On 2017-10-11, Gregory Ewing wrote: > Neil Cerutti wrote: >> I dig const qualifiers, even though I'm comletely fine with >> their absence from Python. > > Out of curiosity, do you have any insights into why you like > them in C++, if you don't miss them in Py

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Neil Cerutti
to a function >> having prototype void f(char *s); > > That *ought* to be prevented. That's the whole point. I'm far less experienced in C, but I threw up my hands and stopped bothering with const qualifiers in C due to such headaches. When in Rome, program without const qualifiers in C. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Neil Cerutti
On 2017-10-13, Steve D'Aprano wrote: > On Fri, 13 Oct 2017 11:54 pm, Gregory Ewing wrote: > >> Neil Cerutti wrote: >>> I can tell at a glance if a parameter is expected to be >>> modifiable just by looking at the function signature. >> >> The que

Re: Compression of random binary data

2017-10-23 Thread Neil Cerutti
>> an inefficient coding > > I suspect he is using ASCII and storing one value in each byte. There's also ZSCII, which stores roughly 3 characters every 2 bytes. Since all the digits are in A2, this sequence would take up 7 bytes in ZSCII as well. http://inform-fiction.org/zmachine/standards/z1point0/sect03.html -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2017-10-23 Thread Neil Cerutti
as well. >> >> http://inform-fiction.org/zmachine/standards/z1point0/sect03.html > > not sure how 16 characters can be represented by either ascii > or zscii in only 8 bytes Oops! I hastily counted completely wrong. It's 10 bytes in ZSCII version 2, using a shift-lock.

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Neil Cerutti
of the list > using '+' operator any other solution, this is not looking > neater > > I am a Linux user using python 2.7 You can use the % operator instead of +, and a generator expression instead of map. It's a pretty small improvement, though. values = '||%s||'

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Neil Cerutti
On 2017-10-31, Stefan Ram wrote: > Neil Cerutti writes: >>You can use the % operator instead of +, and a generator >>expression instead of map. It's a pretty small improvement, >>though. > > "Improvement" in what sense? > > C:\>python -m time

Re: Code Snippets

2017-11-01 Thread Neil Cerutti
o much better! You can import wherever you like--only good style requires you to put them at the top of your file. Moreover, snippets could be a library, with each snippet a function, with the import inside the function. That would keep the module name out of your global namespace. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: How to use a regexp here

2017-12-04 Thread Neil Cerutti
ce 'in' would >> still be true no matter where the desired string is placed. It would be >> useful to see some sample data of the old data, and the new data > > There is now also a line that starts with: > PCH_CPU_TEMP: > > And I do not want that one. You'll probably want to include the ':' in the startswith check, in case someday they also add CPU_TEMP_SOMETHING:. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Neil Cerutti
anyone agree, or am I crazy? I've used csv.DictReader for years and never come across this oddity. Very interesting! I am with you. Silently discarding blank records hides information--the current design is unusable if blank records are of interest. Moreover, what's wrong with a dict ful

Re: How to use a regexp here

2017-12-08 Thread Neil Cerutti
ce 'in' would >> still be true no matter where the desired string is placed. It would be >> useful to see some sample data of the old data, and the new data > > There is now also a line that starts with: > PCH_CPU_TEMP: > > And I do not want that one. You'll probably want to include the ':' in the startswith check, in case someday they also add CPU_TEMP_SOMETHING:. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: csv.DictReader line skipping should be considered a bug?

2017-12-11 Thread Neil Cerutti
mber of fields is broken in the data. In my opinion, it should do a thing that makes it the simplest to handle the situation for the programmer. This is in fact usually what happens. When there are more records than define in the header, you can choose what happens by setting extrasaction. When some records are missing--it sets them to None. Except, when all the records are missing, it silently hides the error with no ability provided to recover it. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: csv.DictReader line skipping should be considered a bug?

2017-12-11 Thread Neil Cerutti
On 2017-12-11, Neil Cerutti wrote: > On 2017-12-05, Steve D'Aprano wrote: >> On Wed, 6 Dec 2017 04:20 am, Jason wrote: >>> while iterating over two files, which are line-by-line >>> corresponding. The DictReader skipped ahead many lines >>> breaking

Re: Problem with assignment. Python error or mine?

2017-12-21 Thread Neil Cerutti
import numpy as np > > X=np.arange(1, 1, 1) #root variable np.arange creates an object. The assignment makes X refer to that object. > x1=X X refers to the previous object, and then the assignment makes x1 refer to that same object. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

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