is python 3 better than python 2?

2011-04-05 Thread neil
what are the advantages? if it wasn't for python 3 breaking backwards compatibility would it be the better choice? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ask for help on using re

2021-08-05 Thread Neil
Jach Feng wrote: > I want to distinguish between numbers with/without a dot attached: > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) > ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').findall(text) > ['ch 23', 'ch 4 ', 'ch 56 '] > > I

Re: Help me split a string into elements

2021-09-04 Thread Neil
DFS wrote: > Typical cases: > lines = [('one\ntwo\nthree\n')] > print(str(lines[0]).splitlines()) > ['one', 'two', 'three'] > > lines = [('one two three\n')] > print(str(lines[0]).split()) > ['one', 'two', 'three'] > > > That's the result I'm wanting, but I get data in a slightly differen

Re: C is it always faster than nump?

2022-02-26 Thread Neil
to get much > of the speed of Fortran in C. But it required using an error prone subset > of C without good error detection. Pointers were introduced in Fortran 90. Neil. -- https://mail.python.org/mailman/listinfo/python-list

python 2.5 and 3gb switch

2007-09-28 Thread neil
really there for 64 bit yet but most of the people wanting to use this exporter will have 32 bit anyway. Any assistance is appreciated regards Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.5 and 3gb switch

2007-09-28 Thread neil
why? I am asking if any one knows of a 3gb python build. The code runs successfully in lesser missions it just wont run in the extra memory available when I try to run it along with my other programs in a 3gb space. thanks for your reply though -- http://mail.python.org/mailman/listinfo/pytho

Re: python 2.5 and 3gb switch

2007-09-29 Thread neil
using Python that is 3gb enabled as well This is the same error I ran across doing smaller tasks without the switch btw Blender does not crash. HTH Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.5 and 3gb switch

2007-09-29 Thread neil
thanks for your interest ...well I am quoting what it says - it gives me some recent lines executed in the console window and then 'memerror' possibly Blenders python API is slightly different from python itself I see there is a python exception MemoryError... most likely this is the equivalent an

Re: python 2.5 and 3gb switch

2007-09-29 Thread neil
script I have requires a full python install. I will see how his assistance goes. Thanks for your willing help guys. regards Neil -- http://mail.python.org/mailman/listinfo/python-list

Newbie Q about Turtle Gfx

2009-02-18 Thread Neil
eError: 'dict' object has no attribute 'forward' I get the same error with t.left(10) etc. etc. I have tried this with V2.6 and V3 Any ideas would be much appreciated. Thanks Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q about Turtle Gfx

2009-02-18 Thread Neil
Forgot to say, that after the error message the turtle window 'hangs' as unresponsive ... "Neil" wrote in message news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com... > Hello > > Sorry if this is not an appropriate newsgroup for this problem. I am very > new to P

Re: Newbie Q about Turtle Gfx

2009-02-18 Thread Neil
Thanks for the very speedy reply! Not sure what your reply means but I have emailed the author with the problem! Cheers Neil "sjbrown" wrote in message news:9ba48cb7-d32b-40ef-a6a6-d22508863...@l33g2000pri.googlegroups.com... It looks like there may be a bug if you were expecti

Re: Newbie Q about Turtle Gfx

2009-02-18 Thread Neil
Thanks everyone! It appears the info in the book is wrong. Trying what you have all suggested has got it to work! Many thanks, and I am sure I will be back here again with other newbie problems! Neil "Neil" wrote in message news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com... > Hello

Re: Newbie Q about Turtle Gfx

2009-02-19 Thread Neil
Hi It turns out I should have used t=turtle.Pen() and not t=turtle.pen() My stupid mistake! "Neil" wrote in message news:jyydnb8xe8hpoghunz2dnuvz8juwn...@bt.com... > Thanks everyone! > > It appears the info in the book is wrong. Trying what you have all > suggeste

Error when import pycurl

2008-10-16 Thread neil
Guys, I meet a error when I import pycurl. Python 2.5.2 (r252:60911, Sep 8 2008, 16:01:08) [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pycurl Traceback (most recent call last): File "", line 1, in ImportErr

Re: First python program, syntax error in while loop

2013-05-06 Thread Neil Cerutti
On 2013-05-06, Mark Lawrence wrote: > On 06/05/2013 13:06, Neil Cerutti wrote: >> On 2013-05-03, John Gordon wrote: >>> In Neil Cerutti >>> writes: >>> >>>> Not quite yet. Players who guess correctly on the fifth try don't >>>>

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Neil Hodgson
th Unicode. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Making safe file names

2013-05-07 Thread Neil Hodgson
CK$', 'Con', or similar. http://support.microsoft.com/kb/74496 http://en.wikipedia.org/wiki/Nul_%28band%29 Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Neil Cerutti
> highway_dict['lanes'], highway_dict['state'], > highway_dict['limit(mph)'] = lanes, state, limit_values > queue_row.append(highway_dict) Can you provide a short example of input and what you had hoped to see in the lists and dicts at the end? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
postrophe for pluralisation. If there's no chance for confusion between a class named FooEntry and another named FooEntries, then the first attempt seems best. Pluralize a class name by following the usual rules, e.g., "strings" and "ints". -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
On 2013-05-09, Jussi Piitulainen wrote: > Neil Cerutti writes: >> If there's no chance for confusion between a class named >> FooEntry and another named FooEntries, then the first attempt >> seems best. Pluralize a class name by following the usual >> rules, e.g.

Re: help on Implementing a list of dicts with no data pattern

2013-05-10 Thread Neil Cerutti
pected output from it, chances are you aren't ready to start writing code. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for philosophers

2013-05-13 Thread Neil Cerutti
, who taught that heavier objects fall faster, was walking past. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [Off topic] Software epigrams

2013-05-13 Thread Neil Cerutti
reflection it speciously inserts the word "irrelevant" in order to avoid stating a tautology: A programming language is low level when its programs require attention to low level details. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [Off topic] Software epigrams

2013-05-15 Thread Neil Cerutti
On 2013-05-13, F?bio Santos wrote: > > On 13 May 2013 19:48, "Neil Cerutti" wrote: >> >> On 2013-05-13, Skip Montanaro wrote: >> >> 8. A programming language is low level when its programs >> >> require attention to the irrelevant. &g

Re: [Off topic] Software epigrams

2013-05-15 Thread Neil Cerutti
read I hope I don't have to till a garden, plant the wheat, harvest the wheat, and grind the wheat. But gardening is relevant to bread baking weather or not I do it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [Off topic] Software epigrams

2013-05-16 Thread Neil Cerutti
n the level of problem for which a programming language is most appropriate. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: any cherypy powred sites I can check out?

2013-05-17 Thread Neil Cerutti
Everybody." I didn't write it myself--I wrote it some asshole.' --Steve Martin -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: A computer programmer, web developer and network admin resume

2013-05-23 Thread Neil Cerutti
On 2013-05-22, Tim Chase wrote: > On 2013-05-22 01:15, i...@databaseprograms.biz wrote: >> A computer programmer, web developer and network administrator > > ...walk into a bar... > > So what's the punchline? "Ow." Get it? "Ow." -- Neil Cerut

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Neil Cerutti
the definition. Where are you perceiving wiggle room? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Utility to locate errors in regular expressions

2013-05-24 Thread Neil Cerutti
ograms like the remake of Dawn of the GREP, just aren't as scary. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Polymoprhism question

2013-05-24 Thread Neil Cerutti
__name__: cls for cls in (A, B)} ArgType = classes[sys.agrv[1]] arg = ArgType() arg.in("test") arg.out("test") -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python #ifdef

2013-05-28 Thread Neil Cerutti
m Python 2 and 3 >> in a single file. >> >> Is that possible? How? You need sys.version_info. For more, see http://python3porting.com/noconv.html -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-30 Thread Neil Cerutti
r. I propose borrowing the concept of significant digits from the world of Physics. The above has at least three significant digits. With that scheme x would approximately equal 17.3 when 17.25 <= x < 17.35. But I don't see immediately how to calculate 17.25 and 17.35 from 17.3, 00.1 an

Re: Installing PyGame?

2013-06-08 Thread Neil Hodgson
ding where Python is with whereis python Then post all of the output text, not just your interpretation. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: py_compile vs. built-in compile, with __future__

2013-06-11 Thread Neil Cerutti
iting the modified module back to a file so that I can still > use py_compile.compile() to byte compile that code. You would use StringIO instead of writing a temp file. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-12 Thread Neil Cerutti
27;=' not in month and '=' not in year: > > It'd be courteous to acknowledge those who made that > suggestion, most notably alex23 who posted it in almost that > exact form. Also, I wish he would stop fudging his From info. I've got something like 8 entries fo

Re: py_compile vs. built-in compile, with __future__

2013-06-12 Thread Neil Cerutti
On 2013-06-11, dhyams wrote: >> You would use StringIO instead of writing a temp file. > > I don't think that would work...py_compile takes a filename as > input, not a file object. Dang. Sorry for the misinfo. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-12 Thread Neil Cerutti
ch you didn't tell us here, including which database you are >> using. > > Are you guys _still_ on Nikos hook? > > [No, I don't really think he's trolling, but it would be really > impressive if he were.] He's definitely trolling. I can't think of any other reason to make it so hard to kill-file himself. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Turnign greek-iso filenames => utf-8 iso

2013-06-12 Thread Neil Cerutti
On 2013-06-12, Mark Lawrence wrote: > On 12/06/2013 13:42, wrote: >> >> Something you want me to try? > > I'd suggest suicide but that would no doubt start another > stream of questions along the lines of "How do I do it?". hi. I loopet rope aroung and jumped, but br

Re: A certainl part of an if() structure never gets executed.

2013-06-13 Thread Neil Cerutti
On 2013-06-12, Zero Piraeus wrote: > On 12 June 2013 10:55, Neil Cerutti wrote: >> >> He's definitely trolling. I can't think of any other reason to >> make it so hard to kill-file himself. > > He's not a troll, he's a help vampire: > &g

Re: Version Control Software

2013-06-13 Thread Neil Hodgson
SourceTree works well on OS X. SourceTree is in beta on Windows and doesn't yet support Hg there. http://tortoisehg.bitbucket.org/ http://www.sourcetreeapp.com/ Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a Super Simple WWW Link, Copy, & Paste into Spreadsheet Program

2013-06-14 Thread Neil Cerutti
r is, much, much simpler. Unless there's some non-trivial need to use Excel directly I strongly recommend exporting as csv and using the csv module. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't feed the troll...

2013-06-14 Thread Neil Cerutti
worst of all, there's none of the closure or vicarious catharsis that usually comes from a well-designed educational transaction. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: My son wants me to teach him Python

2013-06-14 Thread Neil Cerutti
ts in GUI interface have built-in stengths and weaknesses. I was going to write something about them earlier, but I got bogged down when I thought of the issue of accessibilty, which overtakes any such discussion. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: A Beginner's Doubt

2013-06-19 Thread Neil Cerutti
PIL for this project, instead of PyGame. I have not personally used PyGame, but my guess is it will be much harder to create a reasonable GUI with PyGame than with tkinter. But I do not know how difficult this project will be will be even using the libraries of least resistance. The GUI you propose is very simple, except possibly for the dragging and dropping, which I've not tried and might be hairy. Moreover, I have not seriously used PIL and I don't even know if it supports Python 3. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with the "for" loop syntax

2013-06-20 Thread Neil Cerutti
acket, quote or colon. So if you press enter and the autoindent is unexpected, don't just press space or backspace to fix it. It's usually a sign of an earlier syntax error, so look for that first. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with the "for" loop syntax

2013-06-21 Thread Neil Cerutti
On 2013-06-20, Cameron Simpson wrote: > On 20Jun2013 13:55, Neil Cerutti wrote: >| On 2013-06-20, Joshua Landau wrote: >| > On 20 June 2013 04:11, Cameron Simpson wrote: >| >> Also, opening-and-not-closing a set of brackets is almost the >| >> only way in Pyt

Re: Default Value

2013-06-21 Thread Neil Cerutti
rrectly, you have to have mastered three separate Python concepts. 1. How name-binding works. 2. How argument passing works, i.e., via name-binding. 3. When default arguments are evaluated. 4. The Python object model. OK, you have to know four things. Curses! I'll come in again. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a name for a deployment framework...

2013-06-24 Thread Neil Cerutti
ar. If you're thinking of >> this as a fabric replacement, I would go with cloth, textile, material, >> gabardine, etc. > > Snakeskin? Oh, I see that's already taken. :-( Most things are taken nowadays. A short nonsense-word is best. Something like "Folaf". Yeah, it doesn't spark the imagination, but it's easy to find, if not to remember. Well, not "Folaf." That seems to be an African style restaurant in L.A. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this PEP-able? fwhile

2013-06-25 Thread Neil Hodgson
concentrate the code expressing the domain of the loop rather than have it in separate locations. Not a big win in my opinion. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this PEP-able? fwhile

2013-06-26 Thread Neil Cerutti
armful like a > religious edict. The one-exit-point rule is helpful for tracking entry and exit invariants. But in my view it shouldn't be followed when it makes code worse. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Stupid ways to spell simple code

2013-07-01 Thread Neil Cerutti
= { True: lambda: print("No name longer than 20 letters."), False: lambda: True, }[len(name) > 20]() Much better. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Neil Cerutti
s are not only for spam. I filter out anything I believe I won't want to see. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression negative look-ahead

2013-07-02 Thread Neil Cerutti
return true for only > these tables: > MY_TABLE > YOUR_TABLE Use the "is not a word" character class on either end. r"\WMY_TABLE\W" r"\WYOUR_TABLE\W" -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Parser

2013-07-02 Thread Neil Cerutti
eautifulSoup, etc. > HTMLParser works fine for me, but I am looking for a good > tutorial to learn it nicely. Take a read of the topic "Parsing, creating, and Manipulating HTML Documents" from chapter five of Text Processing in Python. http://gnosis.cx/TPiP/chap5.txt -- Neil Ceru

Re: Parsing Text file

2013-07-02 Thread Neil Cerutti
maskit in this file and also > need to print Sometext above it..SOmetext location can vary as > you can see above. > > In the first instance it is 3 lines above mask it, in the > second instance it is 4 lines above it and so on.. > > Please help how to do it? How can you te

Re: Parsing Text file

2013-07-02 Thread Neil Cerutti
> > if is_sometext(line): > memory = line > > if line == 'maskit': > print memory Tobiah's solution fits what little we can make of your problem. My feeling is that you've simplified your question a little too much in hopes that it would help us provide a better solution. Can you provide more context? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python list code of conduct

2013-07-03 Thread Neil Hodgson
t the language. - discussion on programming in Python. http://www.python.org/search/hypermail/python-1994q1/0377.html Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Default scope of variables

2013-07-05 Thread Neil Cerutti
c destruction. It wouldn't buy much except for namespace tidyness. for x in range(4): print(x) print(x) # Vader NOoOO!!! Python provides deterministic destruction with a different feature. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Default scope of variables

2013-07-05 Thread Neil Cerutti
On 2013-07-05, Chris Angelico wrote: > On Fri, Jul 5, 2013 at 11:24 PM, Neil Cerutti > wrote: >> Python provides deterministic destruction with a different >> feature. > > You mean 'with'? That's not actually destruction, it just does > one of the same j

Re: analyzing time

2013-07-05 Thread Neil Cerutti
the methods you will need. To find clusters and min and max values you will likely need to put the datetime objects in a list, and use some Python builtins and list methods. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Default scope of variables

2013-07-08 Thread Neil Cerutti
On 2013-07-07, Steven D'Aprano wrote: > On Fri, 05 Jul 2013 13:24:43 +0000, Neil Cerutti wrote: > >> for x in range(4): >>print(x) >> print(x) # Vader NOoOO!!! > > That loops do *not* introduce a new scope is a feature, not a bug. It is > *real

Re: crack a router passcode

2013-07-09 Thread Neil Cerutti
d just reset it to factory defaults and reconfigure. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Editor Ergonomics [was: Important features for editors]

2013-07-09 Thread Neil Cerutti
That's the system I've adopted. I use the mouse lefty all day when working and righty all night when playing. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: hex dump w/ or w/out utf-8 chars

2013-07-09 Thread Neil Cerutti
ementors: thwarting hexdumping cheaters and cramming their games onto microcomputers with one blow. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: hex dump w/ or w/out utf-8 chars

2013-07-09 Thread Neil Cerutti
ine spec was never officially published either. I believe a "task force" reverse engineered it sometime in the 90's. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: crack a router passcode

2013-07-09 Thread Neil Cerutti
boxes of router's web login >> interface? > > It certainly could. It's just simple HTTP requests, which Python > handles admirably. But this request was sent by a spambot and doesn't > need a response. FRANK DREBBIN Yes... I know that. Now. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Neil Hodgson
problem to at least one person on the list. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Homework help requested (not what you think!)

2013-07-17 Thread Neil Cerutti
hains are an advanced technique you could introduce, but you'd need a huge list of names broken into syllables from somewhere. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Homework help requested (not what you think!)

2013-07-17 Thread Neil Cerutti
On 2013-07-17, Chris Angelico wrote: > On Wed, Jul 17, 2013 at 11:20 PM, Neil Cerutti wrote: >> Markov chains are an advanced technique you could introduce, but >> you'd need a huge list of names broken into syllables from >> somewhere. > > You could use names br

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Neil Cerutti
set again. Thanks to the set-like view of dict.keys it worked just like one might hope. Looking at it again "seen" might be a redundant parallel version of students.keys(). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: import syntax

2013-07-30 Thread Neil Cerutti
1a) Does it work? 1b) Can you prove it? It's best to at least have some regression tests before you start refactoring and optimizing. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-30 Thread Neil Cerutti
chess positions showed that they were powerfully accurate when shown positions from real games, but no better than the average schmoe when shown randomly positioned pieces. So if everyone basically follows PEP8 we all benefit from playing by the same game rules, as it were. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: RE Module Performance

2013-07-30 Thread Neil Hodgson
previous change, so require moving only a relatively small amount of text. Even an occasional move of the whole contents won't cause too much trouble for interactivity with current processors moving multiple megabytes per millisecond. Neil -- http://mail.python.org/mailman/listinfo/p

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
("status", 3141, "Status code from ISO-3.14159"), > ... > ): > do_something(name, value) > print(description) > > which does give some modest readability benefits, but at a > creation cost I personally am unwilling to pay. I'm actually OK with the creation cost, but not the maintenance cost. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Neil Hodgson
removing comments that look like # end if Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Neil Cerutti
otocol when the format and shape are also equal. The database must be returning chunks of binary data in a different shape or format than you are writing it. Perhaps psycopg2 is returning a chunk of ints when you have written a chunk of bytes. Check the .format and .shape members of the return va

Re: code review

2012-07-03 Thread Neil Cerutti
WS! > > Why "poor", Ralph? > > I am poor in the essence of ignorance's bliss, rich only in the > never-ending thirst for knowledge and more languages. In me there meet > a combination of antithetical elements which are at eternal war with > one another... I

Re: Why doesn't Python remember the initial directory?

2012-08-20 Thread Neil Hodgson
e you have only limited permissions. getcwd works by calling readdir and lstat and looping up from the current directory to the root to build the whole path so will break without read permissions on directories: http://www.opensource.apple.com/source/Libc/Libc-763.13/gen/FreeBSD/getcwd.c

Re: How do I display unicode value stored in a string variable using ord()

2012-08-21 Thread Neil Hodgson
offset. This converts many operations from quadratic to linear. Locality of reference is common and can often be reasonably exploited. However, exposing the variable length nature of UTF-8 allows the application to choose efficient techniques for more cases. Neil -- http://mail.pytho

Re: Flexible string representation, unicode, typography, ...

2012-08-23 Thread Neil Hodgson
4025 sys.getsizeof('a' * 80 * 50 + '•') 8040 This example is still benefiting from shrinking the number of bytes in half over using 32 bits per character as was the case with Python 3.2: >>> sys.getsizeof('a' * 80 * 50) 16032 >>> sys.getsizeof('a&

Re: Flexible string representation, unicode, typography, ...

2012-08-27 Thread Neil Hodgson
exp/ Are you claiming that UTF-8 is the optimum string representation and therefore should be used by Python? Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-04 Thread Neil Hodgson
lative and committed operations and address bits on some processors and quickly lost me: paragraph 3 of http://lists.freedesktop.org/archives/pixman/2010-August/000423.html The memcpy patch was controversial as it broke Adobe Flash which assumed memcpy was safe like memmove. Ne

Re: Comparing strings from the back?

2012-09-17 Thread Neil Hodgson
Ethan Furman: *plonk* I can't work out who you are plonking. While more than one of the posters on this thread seem worthy of a good plonk, by not including sufficient context, you've left me feeling puzzled. Is there a guideline for this in basic netiquette? Nei

Re: Batching HTTP requests with httplib (Python 2.7)

2012-09-18 Thread Neil Cerutti
; service_num_list = [num for num in range(0,5)] service_num_list = list(range(5)) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorators not worth the effort

2012-09-18 Thread Neil Cerutti
On 2012-09-14, Chris Angelico wrote: > But then again, who actually ever needs fibonacci numbers? If it should happen that your question is not facetious: http://en.wikipedia.org/wiki/Fibonacci_number#Applications -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: sum works in sequences (Python 3)

2012-09-19 Thread Neil Cerutti
is 0. The function tried to add 'r' to 0. That said: >>> sum('rtarze', '') Traceback (most recent call last): File "", line 1, in TypeError: sum() can't sum strings [use ''.join(seq) instead] -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: sum works in sequences (Python 3)

2012-09-19 Thread Neil Cerutti
x27;.join(sequence). To add floating point values with extended precision, see math.fsum(). To concatenate a series of iterables, consider using itertools.chain(). Are iterables and sequences different enough to warrant posting a bug report? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: howto handle nested for

2012-09-28 Thread Neil Cerutti
e last one. Also, be sure to check itertools for occasionally for cool stuff like this. >>> for values in itertools.product(range(3), repeat=2): ... print(values) ... (0, 0) (0, 1) (0, 2) (1, 0) (1, 1) (1, 2) (2, 0) (2, 1) (2, 2) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

zip_longest_by

2012-10-17 Thread Neil Cerutti
d tuple(grouper(item) for item in zip(*accum)) break yield tuple(grouper(item) for item in zip(*accum)) The interface could stand improvement. I find the grouper argument very convenient, but none of the other grouping iterators find it needful. Forcing n to be a keyword argument is unfortunate as well. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Neil Cerutti
and it makes printouts easy to create. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: get each pair from a string.

2012-10-23 Thread Neil Cerutti
oices of algorithm and implentation. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: simple string format question

2012-10-25 Thread Neil Cerutti
int a fixed number of digits after the decimal point, so it won't do want Adrien wants. Adrien, you will need to do some post-processing on fixed point output to remove trailing zeroes. >>> print("{:.2f}".format(2.1).rstrip('0')) 2.1 >>> print("{:.2f}".format(2.127).rstrip('0')) 2.13 -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: bit count or bit set && Python3

2012-10-25 Thread Neil Cerutti
h arithmetic: def is_palindrom(n): s = str(n) return s = s[::-1] > Here's some timing results using Python 2.7: Excellent work. You can of course drop to C for arithmetic and likely triumph over Python strings. That's never been applicable for me, though. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: bit count or bit set && Python3

2012-10-25 Thread Neil Cerutti
On 2012-10-25, Neil Cerutti wrote: > Try defeating the following with arithmetic: > > def is_palindrom(n): >s = str(n) >return s = s[::-1] Sorry for the typos. It should've been: def is_palindrome(n): s = str(n) return s == s[::-1] -- Neil Cerutti -- ht

Re: bit count or bit set && Python3

2012-10-26 Thread Neil Cerutti
On 2012-10-25, Ian Kelly wrote: > On Thu, Oct 25, 2012 at 2:00 PM, Neil Cerutti > wrote: >> Yes indeed! Python string operations are fast enough and its >> arithmetic slow enough that I no longer assume I can beat a >> neat lexicographical solution. Try defeating the foll

Re: attaching names to subexpressions

2012-10-29 Thread Neil Cerutti
em, and two solutions. Solution 1 has downside > A, and solution 2 has downside B. If he complains about > downside A, you say, well, use solution 2. If he complains > about downside B, you say, well, use solution 1. > > What if he wants to avoid both downsides A and B? What solution > does he use then? You abandon the while loop and compose a generator. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: csv read clean up and write out to csv

2012-11-02 Thread Neil Cerutti
if tag == 'html': print rec elif tag == 'csv': writer.writerow(rec) else: raise ValueError("Unknown record type %s" % tag) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: creating size-limited tar files

2012-11-07 Thread Neil Cerutti
ize(tar_file) >= limit: > close(tar_file) > tar_file = new_tar_file() > I have not used this module before, but what you seem to be asking about is: TarFile.gettarinfo().size But your algorithm stops after the file is already too big. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >