Re: Error Testing

2013-10-31 Thread Neil Cerutti
On 2013-10-31, rusi wrote: > On Thursday, October 31, 2013 8:50:27 PM UTC+5:30, Neil Cerutti wrote: >> wrote: >> > This suggests that Pascal went against established practice. >> > This is false. FORTRAN used = and that was a mistake caused by >> > the langua

Re: telnet problem

2013-11-01 Thread Neil Cerutti
On 2013-11-01, wrote: > hello every expert, > When I use telnetlib to send a command, I meet some troubles, I > have read some documents about telnetlib and modify many times, > but the script doesn't work all the time. What goes wrong? -- Neil Cerutti -- https://mail.p

Re: how to find out utf or not

2013-11-05 Thread Neil Cerutti
source bytes. Unless there's some context I'm not privy to. u'x' is (hopefully) decoded already, but the encoding of 'x' is unknown. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: To whoever hacked into my Database

2013-11-07 Thread Neil Cerutti
COWardly :-) >> >> Well, maybe the issue is MOOt. > > Ugh, if only these puns were like CALF-way funny... > > *dives for cover* Phew! I can't stomach stomach stomach this digression. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: To whoever hacked into my Database

2013-11-07 Thread Neil Cerutti
> convention for the start of your signature, and many people and UAs > will ignore text after it.) It's '-- ', with a space after, to be precise. But I like it the way he's doing it! His messages are greatly improved from where I'm sitting.. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-07 Thread Neil Cerutti
rage scheme, you can't. So by storing the data this way, you are promising yourself that you'll never need to write that query, or at least, you won't need to do it very often. > I still don't know why you push me to create an extra table > instead. Because

Re: To whoever hacked into my Database

2013-11-08 Thread Neil Cerutti
On 2013-11-08, ru...@yahoo.com wrote: > Just wanted to let you know that not everybody here is an > asshole. It is just that assholes, by their nature, are the > loudest. Hey man, pass that over! -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Neil Cerutti
but I haven't tried it for that. > I'd use this select if it was in Python, but I don't see much > need for it. Same here. Perhaps the real value of a switch is that it seems to be a more natural way of thinking about execution. The caveat to that is most *actual* switch implementations are a mess. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Neil Cerutti
rings down to one string is a lot > less common. So, let's have some real-world use cases and then > we can talk recommendations. I'd like to know what "string replacement" is supposed to mean in the context of Python. -- Neil Cerutti "A politician is an arse

Re: Benefit and belief

2011-09-30 Thread Neil Cerutti
ng right, proper and correct been so thoroughly celebrated. Except perhaps when my C++ program compiles without warnings. That's pretty good, too. -- 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: Benefit and belief

2011-09-30 Thread Neil Cerutti
is night," you are making an assertion about a position on the surface of the earth and its relationship to the sun. If you are not discussing a specific a position on the Earth, then you cannot make a meaningful assertion about night or day at all. Night and Day are not qualities of the entir

Re: Suggested coding style

2011-09-30 Thread Neil Cerutti
with feature X type question is > normally "gnus" - although I don't know what "Gmail-like style" is. slrn. Is good. -- 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: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Neil Hodgson
jkn: > FWIW, this looks rather like the 'PAR' construct of Occam to me. > > http://en.wikipedia.org/wiki/Occam_%28programming_language%29 Earlier than that, 'par' is from Algol 68: http://en.wikipedia.org/wiki/ALGOL_68#par:_Parallel_processing Neil -- h

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-18 Thread Neil Cerutti
Options Click the File Types tab in the Folder Options menu. There will be an upper view with registered filed types, and some buttons below far making changes to them. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: How to: Coordinate DictReader and Reader for CSV

2011-11-21 Thread Neil Cerutti
those numbers, you want: [...] print data['0'] print data['1'] print data['2'] print data['3'] print data['4'] [...] -- Neil Cerutti "This room is an illusion and is a trap devisut by Satan. Go ahead and dauntlessly! Make rapid progres!" --Ghosts 'n Goblins -- http://mail.python.org/mailman/listinfo/python-list

Re: How to: Coordinate DictReader and Reader for CSV

2011-11-21 Thread Neil Cerutti
line writer.writerow({f: f for n in fields}) for record in reader: # Change a few fields # [...] writer.writerow(record) -- Neil Cerutti "This room is an illusion and is a trap devisut by Satan. Go ahead and dauntlessly! Make rapid progres!" --Ghost

Re: How to: Coordinate DictReader and Reader for CSV

2011-11-21 Thread Neil Cerutti
On 2011-11-21, Neil Cerutti wrote: > On 2011-11-21, ray wrote: >> Is there a way to capture the keys outside of the for loop so >> when the for loop is entered, only data is extracted? > > I have sometimes done the following type of thing, since > DictReader doesn't

Re: correct usage of a generator?

2011-11-28 Thread Neil Cerutti
e you might need that won't work. The following assumes you'll need less than 1000. counter = itertools.count() ... with open("%03d" % counter.next(), "w") as the_next_file: ... My Python < 3.0 is rusty, so sorry if I messed that up. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
always held with the "anti-functional style conspiracy" interpretation of Python's lambda expressions. They were added but grudgingingly, made weak on purpose to discourage their use. -- Neil Cerutti "This room is an illusion and is a trap devisut by Satan. Go a

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
On 2011-11-28, Gregory Ewing wrote: > Neil Cerutti wrote: >> I've always held with the "anti-functional style conspiracy" >> interpretation of Python's lambda expressions. They were added >> but grudgingingly, made weak on purpose to discourage their >

Re: Total newbie question: Best practice

2011-11-29 Thread Neil Cerutti
for each part of the program. The resultant refactored programs are much easier to test, read and maintain. TLDR: "Called-only-once" functions like main are useful as documentation, hooks for testing, and for unraveling a snarl of global variables. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions about LISP and Python.

2011-12-07 Thread Neil Cerutti
On 2011-12-07, Terry Reedy wrote: > It does not pretend that surrounding statements with > parentheses turns them into expressions. > ;-) I like being in a sexpression. Aww YEH! -- (Neil Cerutti) -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting the current directory path and the path where python script is saved

2011-12-13 Thread Neil Cerutti
os.path.basename(sys.argv[0]). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Neil Cerutti
starting point for learning pointers, though since you already know C that won't do you as much good. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-21 Thread Neil Cerutti
hen you could as well write C++ compatible C and be pretty happy with the results. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-21 Thread Neil Cerutti
On 2011-12-21, Grant Edwards wrote: > On 2011-12-21, Neil Cerutti wrote: >> On 2011-12-20, Paul Rubin wrote: >>> Grant Edwards writes: >>>> Oops. I should have mentioned this is for embedded systems >>>> programming so templates in general (and ST

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-22 Thread Neil Cerutti
7;m only half joking... :) > > Half joking, indeed. I happen to know for a fact that there > are *fourteen* people on the planet who understand it. One of its greatest contributions to computer science were Glassbarrow's C++ puzzles. They likely couldn't have been as ch

Re: what does 'a=b=c=[]' do

2011-12-23 Thread Neil Cerutti
On 2011-12-23, Neil Cerutti wrote: > Is the misfeature that Python doesn't evaluate the default > argument expression every time you call the function? What > would be the harm if it did? ...you know, assuming it wouldn't break existing code. ;) -- Neil Cerutti -- htt

Re: what does 'a=b=c=[]' do

2011-12-23 Thread Neil Cerutti
ing >> multiple inheritence was a bug and asking it to be removed. > > Both of these could arguably be called misfeaures, but not > bugs. Is the misfeature that Python doesn't evaluate the default argument expression every time you call the function? What would be

Re: Early and late binding [was Re: what does 'a=b=c=[]' do]

2011-12-23 Thread Neil Cerutti
On 2011-12-23, Steven D'Aprano wrote: > On Fri, 23 Dec 2011 13:13:38 +0000, Neil Cerutti wrote: >> On 2011-12-23, Neil Cerutti wrote: >>> Is the misfeature that Python doesn't evaluate the default >>> argument expression every time you call the function?

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
formatting should not > be deprecated at all. When it becomes necessary, it's possible to optimize it by hoisting out the name lookups. ... outfil_write = outfil.write append_newline = "{}\n".format ... outfil_write(append_newline(t)) ... -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Stefan Krah wrote: > Neil Cerutti wrote: >> > In the real-world telco benchmark for _decimal, replacing the >> > single line >> > >> > outfil.write("%s\n" % t) >> > >> > with >> > >> >

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Neil Cerutti wrote: > On 2012-01-03, Stefan Krah wrote: >> Neil Cerutti wrote: >>> > In the real-world telco benchmark for _decimal, replacing the >>> > single line >>> > >>> > outfil.write("%s\n"

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Neil Cerutti
words in the registry. You still have to copy of the text, but only once. The C++ implementation starts to smell sort of like Python. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
100 -s "n=7.92" "'%s' % n" 100 loops, best of 3: 0.965 usec per loop C:\WINDOWS>python -m timeit -n 100 -s "n=7.92" "'{}'.format(n)" 100 loops, best of 3: 1.17 usec per loop -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing __dict__ with an OrderedDict

2012-01-09 Thread Neil Cerutti
an idea that is usually a bad practice, then it should be challenged. The possible broken-nose of a questioner is a small price to pay for the education of the peanut gallery. If a questioner does not wish to defend what they are doing, he or she has that right, of course. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: contextlib.contextmanager and try/finally

2012-01-11 Thread Neil Cerutti
generator in an object with __enter__ and __exit__ methods for you. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: copy on write

2012-01-13 Thread Neil Cerutti
pecifically, it confuses > almost everyone the first time they encounter it that "a += b" > is not the same as "a = a + b". If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. A C++ programmer would be wondering how either can work on immutable objects, and that's where Python's magical rebinding semantics come into play. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: copy on write

2012-01-13 Thread Neil Cerutti
Pike. >> >> (With apologies to Larry Wall) > > Were one inclined to troll a bit, one might be tempted to claim > that using C++ is prima facie evidence of not understanding > C++. > > Not that I would ever claim something inflamitory like that... On the Python newsgro

Re: copy on write

2012-01-13 Thread Neil Cerutti
On 2012-01-13, Evan Driscoll wrote: > On 01/13/2012 10:54 AM, Neil Cerutti wrote: >> If you've ever implemented operator=, operator+, and operator+= >> in C++ you'll know how and why they are different. > > At the same time, you'd also know that that implementi

Re: Opinion on best practice...

2013-02-05 Thread Neil Cerutti
ent option for writing shell scripts, particularly if your shell is cmd.exe. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Opinion on best practice...

2013-02-06 Thread Neil Cerutti
On 2013-02-05, Grant Edwards wrote: > On 2013-02-05, Neil Cerutti wrote: >> On 2013-02-05, Walter Hurry wrote: >>>> Sorry, I'm a Linux guy. I have no clue what that means. >>> >>> Hooray for common sense! Python is great, but it's silly to us

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Neil Hodgson
on mark as a visual cue for in-place modification of the object: Ruby does not use '!' to indicate in-place modification: http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Neil Hodgson
ot;[aeiou]+" >> vowels.object_id => 2234951380 >> WEBrick::HTTPUtils._make_regex!(vowels) => /([^\[aeiou\]\+])/n >> vowels => "[aeiou]+" >> vowels.object_id => 2234951380 The counterpart, exclamation without mutation. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: First attempt at a Python prog (Chess)

2013-02-15 Thread Neil Cerutti
On 2013-02-15, Oscar Benjamin wrote: > if score > best_score or best_score is None: You need the None check first to avoid an exception from the comparison. if best_score is None or score > best_score: -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: First attempt at a Python prog (Chess)

2013-02-19 Thread Neil Cerutti
On 2013-02-15, MRAB wrote: > On 2013-02-15 16:17, Neil Cerutti wrote: >> On 2013-02-15, Oscar Benjamin wrote: >>> if score > best_score or best_score is None: >> >> You need the None check first to avoid an exception from the >> comparison. > > Only

Re: Python 3.3 vs. MSDOS Basic

2013-02-20 Thread Neil Cerutti
larly good example of a Project Euler problem, you'll need to do some mathematical analysis to improve your approach, first. But yeah, do not get in the habit of comparing your times to, say, C++ programs. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: FYI: AI-programmer

2013-02-22 Thread Neil Cerutti
ull poems written > by computers. Fooled a lot of people. The painting elephants are trained to paint basically the same painting over and over. There's not much chance involved. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Small program ideas

2013-02-26 Thread Neil Cerutti
hallenge. http://www.pythonchallenge.com/ -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up Python's exit

2013-02-28 Thread Neil Cerutti
Disabling gc before exiting might do the trick, assuming you're assiduously managing other resources with context managers. gc.disable() exit() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Read csv file and create a new file

2013-02-28 Thread Neil Cerutti
: > > > mtgoxeur 12 24 36 > mtgoxpln 2 4 6 > > Thanks to anyone that can help You don't appear to need the csv module at all. You'll just need the startswith string function. For more help, please show us some code. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Read csv file and create a new file

2013-02-28 Thread Neil Cerutti
d["ask"] is not None: > if not any(str(d["symbol"]) in s for s in string): Why are you checking d["symbol"] instead of d["currency"]? Maybe I misunderstood the question. Test like this for either set or list container type. Use whichever json field is appropriate: if d["currency"] not in esclusioni: > c.writerow([str(d["currency"]),str(d["symbol"]),str(d > ["bid"]),str(d["ask"]),str(d["currency_volume"])]) > > esclusioni.close() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Largest possible size for executemany() in PEP-249 (Database API)

2013-02-28 Thread Neil Hodgson
ions look like as INSERT statements and see how many fit into max_allowed_packet. max_allowed_packet is probably 1 million so looking like 100 bytes per INSERT but will depend on data as inserting "Ko" should use less bytes than inserting "Naragarajan". Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive function

2013-03-05 Thread Neil Cerutti
reverse after reverse1 is exactly the same. I can now write my recursive reverse function. def reverse_any(s): if len(s) <= 1: return s else: return s[-1] + reverse_any(s[:-1]) Try this exercise with your conversion problem and see if you can make progress. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Config & ConfigParser

2013-03-07 Thread Neil Cerutti
Config: host = "ftp" port = 21 proxy = "192.168.0.3:81" user = "transfers" password = "secret" How much to engineer stuff is up to you. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.filterfalse - what is it good for

2013-03-08 Thread Neil Cerutti
iciency only. It can trivially be replaced by filter in all cases (at least in Python 3), but it saves you from a possibly slow extra function indirection, and also from needing to define one at all. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: crypto program in python.

2013-03-08 Thread Neil Cerutti
) > print decode(coded) > elif response == "0": > print "Thanks for doing secret spy stuff with me." > keepGoing = False > else: > print "I don't know what you want to do..." > > --- > > I am

Re: crypto program in python.

2013-03-08 Thread Neil Cerutti
an example of something you tried that didn't work? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: String performance regression from python 3.2 to 3.3

2013-03-16 Thread Neil Hodgson
0 characters of Unicode contains Latin (with extensions), Greek, Cyrillic, Arabic, Hebrew, and most Indic scripts. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Excel column 256 limit

2013-03-19 Thread Neil Cerutti
el use the csv module and create the file using the default 'excel-csv' format. Then load the file using Excel. Creating an Excel file directly in Python is possible, but I think it will require use of the Pywin32 extensions. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: What am I doing wrong in this simple tkinter example?

2013-03-19 Thread Neil Cerutti
basis... more frequently > if you use Microsoft Windows, tar, non-eight-bit-clean > transmission methods, or Adobe products, and extremely common > as soon as you take over someone else's code [1], but > inevitable even without these stimuli. :) A pretty funny example of this is

Re: How to send data from excel to website using python please help?

2013-03-19 Thread Neil Cerutti
d from them directly using something like xlrd if you prefer, but I find it pales in comparison. My advice is to avoid reading the Excel file directly unless you have no other choice. Happily (for me) I don't know the answer to the second part of your question. -- Neil Cerutti -- http://mail.py

Re: Replace "dash" values in a field with new line- VB equivalent of Python

2013-03-19 Thread Neil Cerutti
trings in Python, so you need to bind something to them. I don't know what the VB syntax above means, but if I pretend that your string is bound to 'Name': Name = Name.replace(" - ", "\n") -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Excel column 256 limit

2013-03-20 Thread Neil Cerutti
On 2013-03-19, Ian Kelly wrote: > On Tue, Mar 19, 2013 at 8:44 AM, Tim Chase > wrote: >> On 2013-03-19 14:07, Neil Cerutti wrote: >>> On 2013-03-18, Ana Dion?sio wrote: >>> > But I still get the error and I use Excel 2010. >>> > >>> >

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Neil Cerutti
None, your usual assumptions about focus would apply, otherwise the user preference overrides it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Neil Cerutti
On 2013-03-26, Dave Angel wrote: > On 03/26/2013 10:40 AM, Michael Herrmann wrote: >> On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: >>> >>> >>> Have you considered adding a keyword argument to each of your >>> global functions,

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Neil Hodgson
internal representation to me. One benefit of UTF-8 over Python's flexible representation is that it is, on average, more compact over a wide set of samples. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Neil Hodgson
a French document that needs to include one mathematical symbol (or emoji) outside Latin-1 will double in size as a Python string. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Neil Hodgson
is to build a fixed width version of the regex code and then interpose an object that converts between the UTF-8 representation and that code. The C++11 standard library contains a regex template that can be instantiated over a UTF-8 representation in this way. Neil -- http

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Neil Hodgson
n the parse then you remember the positions (as iterators) at the significant places and extract/process the data based on those positions. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Neil Cerutti
mentioned is to match using a generator function: def match_each(s, re_seq): for r in re_seq: yield r.match(s) And later something like: for match in match_each(s, (expression1, expression2, expression3)): if match: print(match.groups()) # etc... -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Small program ideas

2013-03-29 Thread Neil Cerutti
e final program in small steps. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: No errors displayed but i blank scren nstead.

2013-03-29 Thread Neil Cerutti
e killfiled already. Must be he/she/it is posting from a different sock puppet. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a dictionary from a .txt file

2013-04-01 Thread Neil Cerutti
His name, in combination with a similarly named rap artist, breaks most search tools. My guess is this homework is simply borken. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-01 Thread Neil Hodgson
py" 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] a=['C:/Users/Neil/Documents/b','C:/Users/Neil/Documents/z']176 [0.7116295577956576, 0.7055591343157613, 0.7203483026429418] a=['C:/Users/Neil/Documents/λ','C:/Users/Neil/Documents/η']1

Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson
arger performance decrease than the 64-bit version. Reported the issue as http://bugs.python.org/issue17615 Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson
list.txt", "w") as f: f.write("\n".join(paths)) else: with open("filelist.txt", "r") as f: paths = f.read().split("\n") print(len(paths)) timeStart = time.time() paths.sort() timeEnd = time.time() print("Time taken=", timeEnd - timeStart) Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson
actual programs. Once it can read email though, it has to be a real program. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson
otential client -confidentiality problems and the need to audit a list that long. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson
)] 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] The machine is running Windows 8 64-bit (the Python installations are 32-bit though) and the processor is an i3 2350M running at 2.3 GHz. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
2 elif maxChar >= 128: b = 1 bucket[b] = bucket[b] + 1 print("ASCII", bucket[0]) print("Latin1", bucket[1]) print("BMP", bucket[2]) print("Astral", bucket[3]) Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
be loaded more quickly from databases or files or be created by processing. Reading the example data from a file takes around the same time as sorting. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
rusi: Can you please try one more experiment Neil? Knock off all non-ASCII strings (paths) from your dataset and try again. Results are the same 0.40 (well, 0.001 less but I don't think the timer is that accurate) for Python 3.2 and 0.78 for Python 3.3. Neil -- http://mail.pytho

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
ax cmp edi, ecx pop edi pop esi setne al pop ebx ; 10439: } mov esp, ebp pop ebp ret 0 _unicode_compare ENDP Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a dictionary from a .txt file

2013-04-03 Thread Neil Cerutti
On 2013-04-01, Steven D'Aprano wrote: > On Mon, 01 Apr 2013 11:41:03 +0000, Neil Cerutti wrote: > > >> I tried searching for Frost*, an interesting artist I recently learned >> about. > > "Interesting artist" -- is that another term for "wanker&quo

Re: Mixin way?

2013-04-03 Thread Neil Cerutti
e attribute > DEFAULTS = {} > REQUIRED = [] > OPTIONAL = [] > TO_RESOLVE = [] > MIXINS = [] > > Where every subclass can redefine these attributes to get > something done automatically by the constructor for > convenience. Hopefully someone with experience with them can help you further, but this seems like a job for a metaclass. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Distributing a Python program hell

2013-04-03 Thread Neil Cerutti
program.) > > Run: python baudotrss.py --help > > I'm thinking of switching to Go. Python programs can be distributed as binary-like packages, e.g., www.py2exe.org. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
Neil Hodgson, replying to self: The assembler (32-bit build) for each PyUnicode_READ looks like Don't have 64-bit MSVC 2010 set up but the code from 64-bit MSVC 2012 is better since there are an extra 8 registers in 64-bit mode: ; 10431: c1 = PyUnicode_READ(kind1, dat

Re: In defence of 80-char lines

2013-04-04 Thread Neil Cerutti
x27;server_name'), get_backend), (('Tq', 'Tw', 'Tc', 'Tr', 'Tt'), get_track_info), ] result = {} for i, s in enumerate(s.split()): if i < len(matchers): # I'm not finished writing matchers yet. key, matcher =

Re: I hate you all

2013-04-06 Thread Neil Cerutti
e Stroustrup likes it, and I agree with him that code is even easier to read that way, especially in hard-copy. But most tools have not caught up with the idea. I'll switch as soon as vim supports it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-06 Thread Neil Cerutti
On 2013-04-06, Roy Smith wrote: > In article , > Neil Cerutti wrote: > >> Bjarne Stroustrup likes it > > This is supposed to impress me? Hehe. No! But he's got enough clout to give the notion some traction. > Yeah, most of the books I recall that used this wer

Re: Can I iterate over a dictionary outside a function ?

2013-04-11 Thread Neil Cerutti
;> returned so cannot be iterated upon. >> >> Please suggest some way by which it can be made possible to >> iterate over the dictionary using iterkeys outside the >> function ? > > If you're using Python 3 iterkeys has been renamed keys. Also, using a dict

Re: guessthenumber print games left

2013-04-11 Thread Neil Cerutti
still true. Here's and example. maximum_games = 4 # You must stop playing after 4 games. games_played = 0 # Always equals the number of games played while games_played < maximum_games: play_game() # This is where you update games_played to reflect the number # of games played.

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Neil Cerutti
info:"+loc+fname+":\n", os.stat(loc+fname) > > But when I look at the file in Finder, destination is smaller > and even looking at the file (with text editor) file is > truncated. > > What could be causing this? Could fn be getting some changes written after the copy is made? Is the file flushed/closed before you copy it? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Neil Cerutti
urn until that's done. What command are you using to create the temp file? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-12 Thread Neil Cerutti
matters, not > to make lawyers wealthy). Wishful thinking is the wrong way to approach any legal matter. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: classes and sub classes?

2013-04-15 Thread Neil Cerutti
ld others use? > > inventory_db > > The rest should be clear from the context. How long and descriptive a name is ought to depend on the wideness of its visibility. n might be acceptable in a short comprehension, while network_inventory_db_connection might be apposite for a module-level name. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie questions on Python

2013-04-16 Thread Neil Cerutti
he following for loop taking place somewhere: for (int i = 2; i <= 0; --i) { fprintf(a[i]); } -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie questions on Python

2013-04-16 Thread Neil Cerutti
On 2013-04-16, Lele Gaifax wrote: > Neil Cerutti writes: > >> Imagine something like the following for loop taking place >> somewhere: >> >> for (int i = 2; i <= 0; --i) { >> fprintf(a[i]); >> } > > Neil most probably meant &

Re: anyone know pandas ? Don't understand error: NotImplementedError...

2013-04-18 Thread Neil Cerutti
should be using one of its subclasses instead, e.g., BusinessDay, MonthEnd, MonthBegin, BusinessMonthEnd, etc. http://pandas.pydata.org/pandas-docs/dev/timeseries.html -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

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