Re: pip3.x error using LIST instead of list

2014-02-12 Thread Neil Cerutti
DOS, Windows, and Linux > computers for years: > > disable the caps-lock key I really liked rebinding it to Left-CTRL. I only stopped doing that because it screwed up my work flow when not at a keyboard I could remap. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python programming

2014-02-13 Thread Neil Cerutti
ust the beginning, but it's a pretty good place. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
. There will be an exception only if it is zero-length. But good point! That's a pretty sneaky way to avoid checking for a zero-length string. Is it a popular idiom? -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
the fastest after all? I think the following would occur to someone first: if key[0] == '<' and key[-1] == '>': ... It is wrong to avoid the obvious. Needlessly ornate or clever code will only irritate the person who has to read it later; most likely yourself. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
ll catch that with your unit tests ;) It's easy to forget exactly why startswith and endswith even exist. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
<' and key[-1] == '>'" > Traceback (most recent call last): > File "P:\Python34\lib\timeit.py", line 292, in main > x = t.timeit(number) > File "P:\Python34\lib\timeit.py", line 178, in timeit > timing = self.inner(it, self.timer) > File "", line 6, in inner > key[0] == '<' and key[-1] == '>' > IndexError: string index out of range The corrected version key and key[0] == '<' and key[-1] == '>' probably still wins the Pretty Unimportant Olympics. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one use Python to learn and even apply Functional Programming?

2014-02-18 Thread Neil Cerutti
a followup to that mind-bending experience. http://www.eecs.berkeley.edu/~bh/ss-toc2.html I wouldn't recommend trying to learn anything at the same time as learning Haskell. ;) -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-28 Thread Neil Cerutti
enough features to bother with its implemention. Check out Go's switch statement for an example of what it might look like in Python. Except you'd get it without labeled break or the fallthrough statement. Would you still want to use it? -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: References, and avoiding use of ???variable??? (was: Can global variable be passed into Python function?)

2014-02-28 Thread Neil Cerutti
riables in the local symbol table of the called function. Am I oversimplifying? -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: How security holes happen

2014-03-05 Thread Neil Cerutti
let you, gulp, add more. Well, that or lisp's designers severely underestimated how much we like to use our programming languages as non-RPN calculators. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Closure/method definition question for Python 2.7

2014-03-11 Thread Neil Cerutti
gt; NameError: global name 'x' is not defined. > > In the snippet, x is neither local to __init__() nor global to > the module. It is in the class scope. You can refer to it in > one of two ways: > >Test.x > > or: > >self.x The latter will work only to

Re: golang OO removal, benefits. over python?

2014-03-11 Thread Neil Cerutti
mbined with duck typing and simple distribution of applications is a draw. Go's tools are pretty awesome, and are scheduled for improvements. If you can get by with its built in types (or simple aggregates of them) it feels quite expressive. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Using query parameters subtitution outside of execute()

2014-03-28 Thread Neil Cerutti
ry less manageable that the ones I > used in Python ... C could provide more friendly general purpose containers in its library, but doesn't. There are some good free ones: glib, for example. Cython provides a really nice in-between level. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
xprience, too. Besides, after studying The Pragmatic Programmer I removed nearly all the tables from my code and reference them (usually with csv module) instead. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Grant Edwards wrote: > On 2013-07-31, Neil Cerutti wrote: >> Besides, after studying The Pragmatic Programmer I removed >> nearly all the tables from my code and reference them (usually >> with csv module) instead. > > I don't understand. That jus

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Neil Cerutti
(for example when I want to add instructions to your assembler). >> >> My guess is it would be more foolproof to edit that stuff with a >> spreadsheet. > > There's nothing foolproof about using a spreadsheet! I edit csv files using Excel all the time. But I don'

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Grant Edwards wrote: > On 2013-07-31, Neil Cerutti wrote: >> On 2013-07-31, Grant Edwards wrote: >>> On 2013-07-31, Neil Cerutti wrote: >>>> Besides, after studying The Pragmatic Programmer I removed >>>> nearly all the tables from my

Re: Editing tabular data [was: PEP8 79 char max]

2013-08-01 Thread Neil Cerutti
mined by a person we have to literally query to discover. I think I can see the potential problems. Two special codes for amount is managable, but the more special cases I end up creating the more of a mess I get. Plus, I haven't really documented the file. Most of the information is

Re: Best practice for connections and cursors

2013-08-01 Thread Neil Cerutti
maybe I'll want to someday. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python 'enable' poke and hope programming?

2013-08-01 Thread Neil Cerutti
wasted my time, of course. As I said, I disagree that the speed of using an interpreter is the main issue. Changing certain things, even big things, in a Python program is often much easier than changing something in , say, a C program, due to Duck-Typing and dynamic typing. So experimentation is easier thanks to more maleable code. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Neil Cerutti
ng from a temp file. You'll have to create the temp file and manage attaching processes to it yourself. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Enum vs OrderedEnum

2013-08-07 Thread Neil Cerutti
e the game goes well :-) > > It's actually a reimplementation of a game from 1993, so I'm > somewhat stuck with the terminology. I haven't played MOO1 for at least a month. :) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: right adjusted strings containing umlauts

2013-08-08 Thread Neil Cerutti
string with no Umlaut it uses 3 characters, but for an > Umlaut it uses only 2 characters. > > I guess it has to to with unicode. > How do I get it right? You guessed it! Use unicode strings instead of byte strings, e.g., u"...". -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: c# async, await

2013-08-22 Thread Neil Cerutti
thon.org/dev/peps/pep-3156/ There's also Twisted: http://twistedmatrix.com/trac/ -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send broadcast IP address to network?

2013-08-23 Thread Neil Cerutti
ameError: name 's' is not defined I bet that's not the same traceback you get. Furthermore, port isn't defined either. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEPs should be included with the documentation download

2013-08-23 Thread Neil Cerutti
turn out to be > quite high, but it's not an unreasonable question. I use the compiled html/windows help and the integrated with the interpreter html version of the Python docs, both downloaded and installed for easy access. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python variable as a string

2013-08-23 Thread Neil Cerutti
tring', anothervar='anotherstring') > anotherdict = dict() > if : > anotherdict[akey] = adict['var'] anotherdict[akey] = adict[str(var)] Will actually work, though you might prefer: anotherdict[akey] = adict[''.join(var)] Try them out and see. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking homogeneity of Array using List in Python

2013-08-26 Thread Neil Cerutti
st it into int and Accept. > Else, I would like to skip that input. > > eg. my input is ['1', ' ', 'asdasd231231', '1213asasd', '43242'] > I want it to be interpreted as: > [1, [None], [None], [None], 43242] > > NOTE: NO INB

Re: Checking homogeneity of Array using List in Python

2013-08-27 Thread Neil Cerutti
On 2013-08-26, Joshua Landau wrote: > On 26 August 2013 14:49, Neil Cerutti wrote: >> On 2013-08-25, sahil301...@gmail.com wrote: >>> >>> eg. my input is ['1', ' ', 'asdasd231231', '1213asasd', '43242'] >>> I

Re: New VPS Provider needed

2013-08-27 Thread Neil Cerutti
can't understand how this savant at anti-killfile-fu can't otherwise manage his server. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: New VPS Provider needed

2013-08-27 Thread Neil Cerutti
PLEASE stop baiting Nikos with snide remarks. It makes > this a very unpleasant environment, and sets the tone of the > community, badly. I limit myself to one snide remark every time he escapes my killfile. 'Cause I wish he would stop. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: String splitting with exceptions

2013-08-28 Thread Neil Cerutti
in_brackets = True elif c == ':': yield s[b:i] b = i+1 elif c == "]": in_brackets = False >>> print(list(dns_split(s))) ['foo.[DOM]', '', '[IP6::4361:6368:6574]', '600', ''] It'll gag on nested brackets (fixable with a counter) and has no error handling (requires thought), but it's a start. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: String splitting with exceptions

2013-08-28 Thread Neil Cerutti
,s) >> ['foo.[DOM]', '', '[IP6::4361:6368:6574]', '600', '', ''] >> >> I'm not sure why _your_ list only has one empty string at the end. > > I wondered that. Good point. My little parser fails on that, too. I

Re: python script to gather file links into textfile

2013-08-30 Thread Neil Cerutti
On 2013-08-30, david.d...@gmail.com wrote: > Hi, im looking for someone who can make a script that gathers > all file links from an url into a textfile, like this : > http://pastebin.com/jfD31r1x Michael Jackson advises you to start with the man in the mirror. -- Neil Cerutti

sax.handler.Contenthandler.__init__

2013-08-30 Thread Neil Cerutti
t happens, ContentHandler.__init__ isn't empty, so the above code could fail if the parser isn't prepared for _locator to be undefined. Is the above code is an acceptable idiom? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
t = stack.enter_context(open('another_file', 'w')) It ain't beautiful, but it unfolds the nesting and gets rid of the with statement's line-wrap problems. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
On 2013-09-03, Neil Cerutti wrote: > 3.2 and above provide contextlib.ExitStack, which I just now > learned about. > > with contextlib.ExitStack() as stack: > _in = stack.enter_context(open('some_file')) > _out = stack.enter_context(open('another_file&#x

Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Neil Cerutti
t more knowledge of what it's referring to. > However this looks like something that's too important to > overlook. It's not ambiguous, self-contradictory or incomplete. But it's very densely packed with information; perhaps it's too complete. > I can tell it&#x

Re: Newbie question related to Boolean in Python

2013-09-05 Thread Neil Cerutti
which > means the loop will continue instead of cancelling it. > > Thanks in advance for spending your time to answer my question. Your logic looks OK, but the indentation on your code is screwy. It should not compile like that. There may be indentation errors, but I don't want to ma

Re: PEP8 79 char max

2013-09-06 Thread Neil Cerutti
, then requiring external > the line-renumbering utilities that AppleSoft BASIC required > :-S Though its graphics and sound were far inferior, as a C64 user I was really jealous of the speed of the built-in Apple disk drives. The only programming I did on them was typing in some of the program

Re: how to trouble shoot - RuntimeError: Open Failed

2013-09-06 Thread Neil Cerutti
to begin. We can help better if you show some of your code; a minimal cut-down version that exhibits the error is ideal. Are you literally getting a RuntimeError? That would be weird. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-11 Thread Neil Cerutti
assert len(elts) == 0 > elt = elts[0] I'm confused. Your rewrite looks like an assertion error or an IndexError. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-12 Thread Neil Cerutti
gt; I have one more: > > Dictionaries should iterate over their items instead of their keys. > > Looking forward to contrary opinions. Consider the 'in' operator. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-12 Thread Neil Cerutti
return fn(x,y) > ... return do_stuff > > I understand that python is not a functional language, but it > frustrates me at times. >>> import operator >>> equal = get_do_stuff(operator.eq)(7, 7.0) True -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-12 Thread Neil Hodgson
clipboard allocation to the next 64K. There used to be good reasons for trying to leave some extra room on the clipboard and avoid reallocating the block but I thought that was over a long time ago. To strip NULs off the end of the string use s.rstrip('\0') Neil -- https://ma

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread Neil Cerutti
On 2013-09-13, stephen.bou...@gmail.com wrote: > On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote: >> Stephen Boulet: >> >> >> >> > From the clipboard contents copied from the spreadsheet, the characters >> > s[:80684] were

Re: Python GUI?

2013-09-13 Thread Neil Cerutti
is keyboard, Till is fingers were bloody stumps, And the very last words that were entered in his .blog were: GUI Builders are for chumps, Lord, Lord! Those GUI builders are for chumps. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-18 Thread Neil Cerutti
ot indentation - so we're > talking more like REXX than Python. In fact, it's not uncommon > for poetry to be laid out on a single line with slashes to > divide lines: There's lots of poetry with significant indentation, though. Imbuing the shape of the text on the page with significance is a thing. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-18 Thread Neil Cerutti
On 2013-09-18, Chris Angelico wrote: > On Thu, Sep 19, 2013 at 12:57 AM, Neil Cerutti wrote: >> There's lots of poetry with significant indentation, though. >> Imbuing the shape of the text on the page with significance is a >> thing. > > And you can do that wit

Re: Language design

2013-09-18 Thread Neil Cerutti
On 2013-09-18, wxjmfa...@gmail.com wrote: >>>> 1and 0 > 0 >>>> 'a'or 1 > 'a' >>>> 5if True else 999 > 5 Curse you, FSR! Oh, wait... -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread Neil Hodgson
correctly. win32clipboard is low-level direct access to the Win32 clipboard API. A higher level API which is more easily used from Python could be defined on top of this if anyone was motivated. Neil -- https://mail.python.org/mailman/listinfo/python-list

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-19 Thread Neil Cerutti
On 2013-09-18, Dave Angel wrote: > On 18/9/2013 17:40, Neil Hodgson wrote: > >> Dave Angel: >> >>> So is the bug in Excel, in Windows, or in the Python library? Somebody >>> is falling down on the job; if Windows defines the string as ending at >>&

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
cumenation any more but nothing stops you from examining the result in the next doctest and making yourself happy about it. >>> x = input("indeterminate:") >>> result = "'{}'".format(x)) >>> result.startswith("'") and result.endswith("'") True -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
On 2013-09-23, Neil Cerutti wrote: > Perhaps try the "advanced API" and define your oen > OutputChecker to add the feature that you need. > > Figuring out how to best invoke doctest with your modified > OutputChecker will take some digging in the source, probably > l

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
t; x = input("indeterminate:") >> >> >>> result = "'{}'".format(x)) >> >> >>> result.startswith("'") and result.endswith("'") >> >> True >> > > Hi Neil, thanks for the hint, bu

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-23 Thread Neil Cerutti
at least 1000 rows, an example: > > 0,0,KGD,0,DME,0,,0,0 > > The values I want to extract are KGD and DME (columns 3 and 5). Use the csv module. http://docs.python.org/2/library/csv.html -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: python IDE and function definition

2013-09-23 Thread Neil Hodgson
too ambiguous. Some IDEs allow you to help them understand the context by adding type information. Here's some documentation for Wing IDE that uses an isinstance assertion: http://www.wingware.com/doc/edit/helping-wing-analyze-code Neil -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Neil Cerutti
erated in general; they may be lost or converted to delimiters on some systems, and hence must not be relied on. So putting a raw CR in a binary chunk maybe be intolerable, and you need to use a different encoder. But I'm out of my element. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Understanding how is a function evaluated using recursion

2013-09-26 Thread Neil Cerutti
ll flatten on itself, as in the recursive version, because the stack frames do all the bookkeeping for you. CPython has a limited number of stack frames though, so the version above might be preferable for certain levels of nesting. [1] http://en.wiktionary.org/wiki/bikeshed -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Understanding how is a function evaluated using recursion

2013-09-26 Thread Neil Cerutti
On 2013-09-26, Neil Cerutti wrote: > def flatten(seq): > > [1] http://en.wiktionary.org/wiki/bikeshed In that spirit, it occurs to me that given current Python nomenclature, 'flattened' would be a better name. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write in to already opened excel file by using openpyxl

2013-09-27 Thread Neil Cerutti
hat excel file and save that excel file Show more code, please. And please describe the error more fully. What did you hope to happen, and what happened instead? What have you tried so far? -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: unable to read combo boxes in excel by xlrd package in python

2013-09-27 Thread Neil Cerutti
no multi-select, etc.), and so it's possible a Visual Basic widget was used instead. That would leave the cell contents blank when read, as above. You will need to retrieve the value from the combo-box object directly somehow. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: unable to read combo boxes in excel by xlrd package in python

2013-09-27 Thread Neil Cerutti
On 2013-09-27, Neil Cerutti wrote: > On 2013-09-27, somesh g wrote: >> Hi..there >> >> I want to read the combo box in excel by using "xlrd" but in >> the output it is showing empty message, its not reading the >> combo box can u guys help me how

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Neil Cerutti
just want to shove the food directly into my stomach. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling 3 operands in an expression without raising an exception

2013-09-30 Thread Neil Cerutti
poker, yes? > > I'm going to go out on a limb and suggest that such a suggestion is > outside what people generally consider acceptable on this list. It's reassuring that even a guy like Nikos has his White Knights. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling 3 operands in an expression without raising an exception

2013-09-30 Thread Neil Cerutti
nd > the frustration that leads people to want him to suffer great > pain. I don't want him to suffer great pain, but it would please me if it were possible to annoy him in some way. Like maybe with the sound of a mosquito. B! BzZ! -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Functional Programming and python

2013-09-30 Thread Neil Cerutti
ry of callbacks, with the simple functions defined in-line and the more complex functions defined just before that and referenced instead. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Functional Programming and python

2013-10-01 Thread Neil Cerutti
On 2013-10-01, Steven D'Aprano wrote: > On Mon, 30 Sep 2013 18:36:28 +0000, Neil Cerutti quoted: > >> Why can??t lambda forms contain statements? > > Gah! Please fix your news client! (I see you're using slrn.) > The \x92 bytes found in your message are ap

Re: JUST GOT HACKED

2013-10-02 Thread Neil Cerutti
me value in telling someone why you might killfile them. But actual *plonks* are, I think, manifestation of spotlight syndrome. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread Neil Cerutti
gt; v = ceil(v*100)/100.0 [*] You're binding v to a new float object here, but not modifying y. Thus, this code will have no effect on y. You need to assign to y[k] here instead. for k, v in d.items(): y[k] = round(v, 2) > return Bare returns are not u

Re: Tail recursion to while iteration in 2 easy steps

2013-10-03 Thread Neil Cerutti
lso it means code for this modified Python wouldn't run on > other non-modified interpreters, but it is at least > theoretically possible without breaking Python's assumptions. In any case it's so easy to implement yourself I'm not sure there's any point. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-03 Thread Neil Cerutti
c": 10.0, "d": 10.0}, {"a": 90.0, "b": 0.0, "c": 0.0, "d": > 10.0}] > > However, at the URL, the values show up as 90.43278694123 You'll need to convert them to strings yourself before submitting them, by using % formatting or str.format. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Re for Apache log file format

2013-10-08 Thread Neil Cerutti
= re.compile( r"""(?P\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+ (?P\-)\s+ (?P\-)\s+ (?P\[(.*?)\])\s+# You can even insert comments. (?P\"(.*?)\")\s+ (?P\d{3})\s+ (?P\d+)\s+ (?P\"\")\s+ (?P\((.*?)\))""", re.VERBOSE) -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Encoding of surrogate code points to UTF-8

2013-10-08 Thread Neil Cerutti
to store unchecked UTF-16 such as Windows filenames as UTF-8. It is also incompatible with CESU encoding (described below). So Python's interpretation is conformant, though not without some disadvantages. In any case, "\ud800\udc01" isn't a valid unicode string. In a perfect world it would automatically get converted to '\u00010001' without intervention. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Encoding of surrogate code points to UTF-8

2013-10-08 Thread Neil Cerutti
On 2013-10-08, Neil Cerutti wrote: > In any case, "\ud800\udc01" isn't a valid unicode string. In a > perfect world it would automatically get converted to > '\u00010001' without intervention. This last paragraph is erroneous. I must have had a typo in my te

Re: Encoding of surrogate code points to UTF-8

2013-10-09 Thread Neil Cerutti
clusive way"? Ned, pay no attention to the person whalopping that dead horse. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
type (except in the case of complex numbers (Ha!)). r == c is equivalent to r == abs(c), which returns the magintude of the complex number. I wonder why it was deemed reasonable to do that but not for the float constructor to do the same, or even int. > BTW, one of the earliest things tha

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, MRAB wrote: > On 10/10/2013 16:57, Rotwang wrote: >> On 10/10/2013 16:51, Neil Cerutti wrote: >>> [...] >>> >>> Mixed arithmetic always promotes to the wider type (except in >>> the case of complex numbers (Ha!)). >>> >

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, Ian Kelly wrote: > On Thu, Oct 10, 2013 at 11:48 AM, Neil Cerutti wrote: >> Woah. I thought I was going by what the docs say: >> >> Python fully supports mixed arithmetic: when a binary >> arithmetic operator has operands of different numeric types

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, Oscar Benjamin wrote: > On 10 October 2013 18:48, Neil Cerutti wrote: >> I guess the "if appropriate" part eluded my eye. When *is* it >> appropriate? Apparently not during an equal test. >> >>>>> 5.0 == abs(3 + 4j) >> False >

Re: I am never going to complain about Python again

2013-10-11 Thread Neil Cerutti
On 2013-10-11, Steven D'Aprano wrote: > On Thu, 10 Oct 2013 17:48:16 +0000, Neil Cerutti wrote: > >> >>> 5.0 == abs(3 + 4j) >> False > > Did you maybe accidentally rebind abs? If not, what version of > Python are you using? Honestly, I think I got m

Re: basic maze problem with turtle

2013-10-14 Thread Neil Cerutti
dgment. https://mail.python.org/pipermail/python-list/ -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: skipping __init__ and using exploiting a class member instead

2013-10-21 Thread Neil Cerutti
and template specialization, for example; you get a generic interface with a decoupled implementation which can be optimized for specific types at need. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Class construction

2013-10-22 Thread Neil Cerutti
Python Language Reference 8.7 Class definitions. Here's a link to the 3.3 version of those docs: http://docs.python.org/3.3/reference/compound_stmts.html#class-definitions -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-22 Thread Neil Cerutti
s, not simply to all-bits zero as (I think) C does. This isn't as great a feature as it seems, since the zero value for some built in types, e.g., map, is unusable without manual construction. In addition, you can't define a zero value for your own types. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-22 Thread Neil Cerutti
>> global) and you'll see the difference. > > Ah, that makes sense. Thanks to everyone who corrected my > misunderstanding. > > Well, actually, no it doesn't. I wonder why C specifies such > behaviour? Why would you want non-global arrays to be filled > wit

Re: Python Front-end to GCC

2013-10-22 Thread Neil Cerutti
GCC into an executable. What executable would GCC compile from a program that matched this grammar? spamgram = spam1, { ', ', more_spam }, '.' spam1 = 'Spam' more_spam = spam, { ', ', spam } spam = 'spam' -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-22 Thread Neil Cerutti
On 2013-10-22, Piet van Oostrum wrote: > Neil Cerutti writes: >> Context-sensitive grammars can be parse, too. > > That's not English. Do you mean "parsed"? Thanks, yes, I meant parsed. > But context-sentitive grammars cannot be specified by BNF. Yes

Re: Python Front-end to GCC

2013-10-22 Thread Neil Cerutti
On 2013-10-22, Mark Lawrence wrote: > On 22/10/2013 20:27, Neil Cerutti wrote: >> On 2013-10-22, Piet van Oostrum wrote: >>> Neil Cerutti writes: >>>> Context-sensitive grammars can be parse, too. >>> >>> That's not English. Do you mean &q

Re: Will Python 3.x ever become the actual standard?

2013-10-23 Thread Neil Cerutti
On 2013-10-23, David wrote: > On 23 October 2013 22:57, wrote: >> >> a LARGE number of Python programmers has not even bothered learning version >> 3.x. > > OMG. Please provide their names. We'll send Doug & Dinsdale. I can send Mr. Wendt and Mr. Kid

Re: Will Python 3.x ever become the actual standard?

2013-10-23 Thread Neil Cerutti
second class OS? Ducks and runs for cover :) They usually don't. Users of most distributions have an awesome device called a package manager. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie fucking problem

2013-10-28 Thread Neil Cerutti
ll. Yours is not to reason why, Jamison. You've left out the body of the letter! ... Fine. Send it that way, and tell them the body will follow. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-28 Thread Neil Cerutti
o >>> babel. >> >> I think you do him a disservice. I'm pretty sure it's genuine, >> bona-fide, 24K, dyed-in-the-wool, 99 and 44/100 pure babble. > > I think it's even better than that... maybe even 28.8K! >From my own bailiwick I'd say it's Grade A Medium Amber. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie fr*cking problem

2013-10-29 Thread Neil Cerutti
On 2013-10-29, Steven D'Aprano wrote: > On Mon, 28 Oct 2013 13:20:17 +0000, Neil Cerutti wrote: > >> On 2013-10-27, Ben Finney wrote: >>> I have no particular objection to you responding to those >>> instances of bad behaviour that I've omitted. >>

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread Neil Cerutti
ed about performance that you're > willing to trade clarity for it, you shouldn't be using Python > in the first place. When you detect a code small, as Wolfgang did, e.g., "I'm repeating the same exact test condition in several places," you should not simply ignore it

Re: Help with guessing game :D

2013-10-29 Thread Neil Cerutti
houldn't be embroiled in the morass of interactive programming. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Neil Cerutti
factor++; >square=Math.pow(factor,exponent); > } > factor--; > document.write(factor," "); > square=Math.pow(factor,exponent); > number=number-(factor*factor); > square=1; > factor=1; > } > document.wr

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Neil Cerutti
ython operators and identifiers. > square=1; > factor=1; > print("+",number); > return A bare return at the end of a Python function is not needed. All functions return None if they fall off the end. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-30 Thread Neil Cerutti
except IOError: pass with open(self.full_path, 'b') as infile: # etc... shutil.copy(tempname, self.output_csv) This avoids clobbering output_csv unless new data is succesfully written. I believe TempDirectory isn't available in Python 2, so some other way of creating that path will be needed, and I'm too lazy to look up how. ;) -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Error Testing

2013-10-31 Thread Neil Cerutti
than that characterization accords. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

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