Re: Python questions help

2012-11-19 Thread Neil Cerutti
hat most others can't, .e.g, Chris Sawyer. But, as Louis Moyse, a great musician remarked: "Without hard work, talent means nothing." -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: 10 sec poll - please reply!

2012-11-20 Thread Neil Cerutti
rb, but since it's also a well-used noun it's perhaps not quite as good as send. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems on these two questions

2012-11-20 Thread Neil Cerutti
uence of "elements" starting at "1", > using "distance" as the spacing, until you exceed "n", and you > want to produce a "sum" of all those elements... This one's sort of a trick question, depending on your definition of "trick". The most obvious implementation is pretty good. In both cases a web search and a little high-density reading provides insights and examples for the OP. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare list entry from csv files

2012-11-27 Thread Neil Cerutti
little better, but difflib finds some stuff that it misses. In your case, the name is munged horribly in one of the files so you'll first have to first sort it out somehow. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare list entry from csv files

2012-11-27 Thread Neil Cerutti
for rows, row in enumerate(names): ...though I would find 'rownum' or 'num' or just 'i' better than the name 'rows', which I find confusing. > name_find() > ofile = open('c:/Working/ttest.csv', "wb") > writer = csv.writer(wfile, delimiter=';') > for insert in namelist: > writer.writerow(insert) > wfile.close() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Textmining

2012-11-30 Thread Neil Cerutti
On 2012-11-30, subhabangal...@gmail.com wrote: > Python has one textming library, but I am failing to install it > in Windows. If any one can kindly help. More information needed. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: List problem

2012-12-03 Thread Neil Cerutti
To also index them: vbdix = [i for i, a in emumerate(l) if a[1] == 'VBD'] vbdno = len(indices) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Conversion of List of Tuples

2012-12-04 Thread Neil Cerutti
> There's a built-in that does "reduce(operator.add"; it's called "sum": > >>>> sum(a, ()) > (1, 2, 3, 4) I thought that sort of thing would cause a warning. Maybe it's only for lists. Here's the recipe from the itertools documentation:

Re: CSV out of range

2012-12-04 Thread Neil Cerutti
(x[4]) But do you really need to save the whole file in a list first? You could simply do: for record in csvreader: if len(record) >= 4: sku.append(record[4]) Or even: sku = [record[4] for record in csvreader if len(record) >= 4] -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
y way that felt shorter or more pythonic: I'm really tempted to import re, and that means takewhile and dropwhile need to stay. ;) But seriously, this is a quick implementation of my first thought. description = s.lstrip(string.ascii_uppercase + ' ') product = s[:-len(description)-1] -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Nick Mellor wrote: > Hi Neil, > > Nice! But fails if the first word of the description starts > with a capital letter. Darn edge cases. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Neil Cerutti
FIFTY TWO Chrysler LeBaron.") ['CAR FIFTY TWO', 'Chrysler LeBaron.'] >>> prod_desc("MR. JONESEY Saskatchewan's finest") ['MR. JONESEY', "Saskatchewan's finest"] """ i = 0 while

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
ble. I'm struggling with the empty description bug right now. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
;NO DESCRIPTION") ['NO DESCRIPTION', ''] """ prod = '' desc = '' for k, g in itertools.groupby(s.split(), key=lambda w: any(c.islower() for c in w)): a = ' '.join(g) if k: desc = a else: prod = a return [prod, desc] This has no way to preserve odd white space which could break evil product name differences. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Ian Kelly wrote: > On Wed, Dec 5, 2012 at 7:34 AM, Neil Cerutti wrote: >> Well, shoot! Then this is a job for groupby, not takewhile. > > The problem with groupby is that you can't just limit it to two groups. > >>>> prod_desc("CAPSICUM RE

Re: why does dead code costs time?

2012-12-05 Thread Neil Cerutti
be in function loading time... > I'll check ceval.c > > However, isn't there a room for a slight optim here? (in this case, the > dead code is obvious, but it may be hidden by complex loops and > conditions) Maybe it's the difference between LOAD_CONST and LOAD_GLOBAL. We can wonder why g uses the latter. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Nick Mellor wrote: > Hi Neil, > > Here's some sample data. The live data is about 300 minor > variations on the sample data, about 20,000 lines. Thanks, Nick. This slight variation on my first groupby try seems to work for the test data. def prod_desc(s): p

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Nick Mellor wrote: > Neil, > > Further down the data, found another edge case: > > "Spring ONION from QLD" > > Following the spec, the whole line should be description > (description starts at first word that is not all caps.) This > case br

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-06 Thread Neil Cerutti
On 2012-12-05, Vlastimil Brom wrote: > ... PARSNIP, certified organic I'm not sure on this one. > ('PARSNIP', ', certified organic') -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused compare function :)

2012-12-06 Thread Neil Cerutti
f *not* creating that stupid list_of_strings. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused compare function :)

2012-12-07 Thread Neil Cerutti
On 2012-12-07, Steven D'Aprano wrote: > On Thu, 06 Dec 2012 13:51:29 +0000, Neil Cerutti wrote: > >> On 2012-12-06, Steven D'Aprano >> wrote: >>> total = 0 >>> for s in list_of_strings: >>> try: >>> total += int(s) >

Re: Error .. Please Help

2012-12-13 Thread Neil Cerutti
is working correctly it looks like this: else: raise SomeException("{} can't happen!".format(the_context)) else: raise exception constructs have saved me a lot of time. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-02 Thread Neil Cerutti
or Vim that will allow simple reindenting and a bunch of other cool cursor movement powers I don't even use. ctags will also work, though I've never really needed it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-02 Thread Neil Cerutti
lt indespensable. But even though I can do the same with Python, it doesn't feel crucial when writing Python. The errors are more few. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is awesome (Project Euler)

2013-01-02 Thread Neil Cerutti
are checked. Working to make a solution that's complete and extensible yields the most educational benefits, I think. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: RE Help splitting CVS data

2013-01-21 Thread Neil Cerutti
ttp://www.diveintopython.net/ -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

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

2013-01-24 Thread Neil Cerutti
On 2013-01-24, John Gordon wrote: > In Sharwan Joram > writes: > >> use vim. > > He said he wanted autocomplete. Does Vim have that? Yes, you use its ctags support to get it working, I believe. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

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

2013-01-24 Thread Neil Cerutti
> know Python. I agree. Vim is great, Emacs is great. I'm glad I know one of them. But learning one of them is as project unto itself. So selecting either just for Python is skipping too many decisions and maybe biting off too big a piece of the snake. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: How to debug pyd File in Vs???

2013-01-25 Thread Neil Hodgson
oft.com/en-us/library/windows/desktop/ms679297(v=vs.85).aspx Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: using split for a string : error

2013-01-25 Thread Neil Cerutti
know what the situations are where you want > the behaviour of atoi(). Right. atoi is no good even in C. You get much better control using the sprintf family. int would need to return a tuple of the number it found plus the number of characters consumed to be more useful for parsing. >>>

Re: using split for a string : error

2013-01-25 Thread Neil Cerutti
On 2013-01-25, Hans Mulder wrote: >> Right. atoi is no good even in C. You get much better control >> using the sprintf family. > > I think you meant sscanf. Yes, thanks for knocking that huge chunk of rust off of me. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

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

losing-end-of-row values when manipulating CSV input

2011-07-13 Thread Neil Berg
ot; filter line. I've tried several ways to remove this trailing "\", but to no success. Do you have any suggestions on how to fix this issue? Many thanks in advance, Neil Berg # Purpose: read in a CSV file containing hourly temps. at each station, # then appe

Re: losing-end-of-row values when manipulating CSV input

2011-07-13 Thread Neil Berg
Ethan, Thank you for this tip- you are correct that I saved the data as rich text. I remade the files in VI instead of TextEdit, which allowed me to write a true csv file and the script works as expected now. Thanks again, Neil On Jul 13, 2011, at 2:17 PM, Ethan Furman wrote: > Neil B

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

popular programs made in python?

2011-03-29 Thread Neil Alt
i mean made with python only, not just a small part of python. -- http://mail.python.org/mailman/listinfo/python-list

Re: popular programs made in python?

2011-03-29 Thread Neil Alt
yeah nice example :) impressive. On 3/29/11, Chris Angelico wrote: > On Wed, Mar 30, 2011 at 1:32 AM, Neil Alt wrote: >> i mean made with python only, not just a small part of python. >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > You&#

learn python the hard way exercise 42 help

2011-03-30 Thread neil harper
http://pastie.org/1735028 hey guys play is confusing me, i get how next gets the first room, which is passed when the instance of Game() is created, but how does it get the next room? thanks -- http://mail.python.org/mailman/listinfo/python-list

python fighting game?(like street fighter)

2011-04-05 Thread neil harper
are there any good fighting games in the style of street fighter or guilty gear? -- http://mail.python.org/mailman/listinfo/python-list

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

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