syntax error message

2012-07-12 Thread John Magness
rogram got message in box "syntax error" and after I clicked OK the #2 in the heading Python 3.2.3 was high-lighted  in red and the "or" and "for" words were changed to red letters and program seems to be text only. In other words, I am not able to re-use or change th

New Python build regr test___all__ fails at 'ctypes.macholib.dyld'

2012-07-13 Thread John Pote
be appreciated Regards, John --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: PyQt QCalendarWidget events question

2012-07-16 Thread John Posner
# suppress the single-click action; perform double-click action instead self.first_click_timer.stop() print "Performing double-click action" # prepare for second mouseReleaseEvent self.double_clicked = True # main program app = G.QApplication([]) button = Button("Click or double-click me") button.show() app.exec_() HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread John Nagle
the same problem, for exactly the same reason - boolean types were an afterthought there, too. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: help needed with subprocess, pipes and parameters

2012-07-17 Thread John Pote
bb, path], stdin = bob.stdout, stdout = subprocess.PIPE,) Never looked under the subprocess hood but maybe there's a race condition with the kate subprocess starting before the bob subprocess has set up its stdout. It's unlikely but so easy to check with a sleep between the subproces

Let child process to run while parent is out (multiprocessing)

2012-07-19 Thread John Wong
def main(...): build_id = create_build_id(...) build_stuff return build_id Suppose build_stuff compiles a C program. It could take days to finish, and notify users their builds are ready. I was thinking about using mutliprocessing to handle the build_stuff. So here is a sample: #!/us

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread John Gordon
he current evidence indicates the universe will just keep > expanding, it's more of a "deep freeze death..." Heat death means *lack* of heat. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread John Gordon
ack of heat; in fact, it implies that there'll be > rather more heat than there now is, because we currently have a whole > lot of chemical energy available to be used. *mind blown* -- John Gordon A is for Amy, who fell down the stairs gor.

Re: the meaning of rユ.......ï¾

2012-07-23 Thread John Gordon
bserved outside the U.S. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: the meaning of r’.......‘

2012-07-23 Thread John Roth
On Monday, July 23, 2012 1:59:42 AM UTC-6, Chris Angelico wrote: > On Fri, Jul 20, 2012 at 5:56 PM, levi nie wrote: > > the meaning of r’...‘? > > It's a raw string. > > http://docs.python.org/py3k/tutorial/introduction.html#strings > > Chris Angelico Since this

Re: from future import pass_function

2012-07-26 Thread John Ladasky
On Wednesday, July 25, 2012 9:32:33 PM UTC-7, Ethan Furman wrote: > What code does `pass` run? When do we pass parameters to `pass`? When > do we need to override `pass`? > > Answers: None. Never. Still waiting for a reply from the OP for a use > case. When I brought up this same issue s

Re: from future import pass_function

2012-07-26 Thread John Ladasky
On Wednesday, July 25, 2012 1:40:45 AM UTC-7, Ulrich Eckhardt wrote: > Hi! > > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, and similarly to the print() function, > there could be a pass() function that does and returns nothing. I had

Re: from future import pass_function

2012-07-26 Thread John Ladasky
On Thursday, July 26, 2012 2:23:02 PM UTC-7, Ethan Furman wrote: > That's a reasonable thing to want, and quite easily accomplished by > passing `lambda: None` or `lambda *args, **kwargs: None` instead. That's the same solution that Steven D'Aprano proposed the last time we had this discussion

Re: Intermediate Python user needed help

2012-08-05 Thread John Ladasky
Check line 76 of your code for errors. If line 76 is incorrectly formed, Python may see line 77 as a continuation of line 76 and throw the SyntaxError because of that. -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread John Gordon
own generator function that yields values in whatever order you want: def my_generator(): yield 9 yield 100 for i in range(200, 250): yield i yield 5 -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: On-topic: alternate Python implementations

2012-08-06 Thread John Nagle
en code does something unexpected to other code, the backup interpreter is used to get control out of the trouble spot so that the JIT compiler can then recompile the code. (I think; I've read the paper but haven't looked at the internals.) This is hard to implement and hard to get right. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Arithmetic with Boolean values

2012-08-11 Thread John Ladasky
I have gotten used to switching back and forth between Boolean algebra and numerical values. Python generally makes this quite easy. I just found a case that surprises me. Here is what I want to accomplish: I want to process a list. If the length of the list L is odd, I want to process it o

Re: Encapsulation, inheritance and polymorphism

2012-08-18 Thread John Ladasky
On Tuesday, July 17, 2012 12:39:53 PM UTC-7, Mark Lawrence wrote: > I would like to spend more time on this thread, but unfortunately the 44 > ton artic carrying "Java in a Nutshell Volume 1 Part 1 Chapter 1 > Paragraph 1 Sentence 1" has just arrived outside my abode and needs > unloading :-)

Re: python 6 compilation failure on RHEL

2012-08-20 Thread John Nagle
t ought to help. You might be better off building Python 2.7, but you asked about 2.6. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

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

2012-08-21 Thread John Roth
s and then look at the __file__ attribute. You need to be a bit careful with this; the import machinery was rewritten for the upcoming 3.3 release, and there were several changes to the module information. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Objects in Python

2012-08-22 Thread John Gordon
encing the method object itself, instead of calling it method. In other words, you've left off the parentheses. I.e. you're doing something like this: print my_object.foo Instead of this: print my_object.foo() -- John Gordon A is for Amy, who fell down the stai

Re: help me debug my "word capitalizer" script

2012-08-23 Thread John Ladasky
On Wednesday, August 22, 2012 3:28:18 AM UTC-7, Kamil Kuduk wrote: > less file.txt | sed -e "s/\b\([a-z]\{4,\}\)/\u\1/g" Say what? Yes, you could do a crazy regex at the Linux prompt. But... will you be able to retain that insane syntax in your head until the NEXT time you need to write somet

Re: ctypes - python2.7.3 vs python3.2.3

2012-08-28 Thread John Gordon
ich goes out of scope when myfunction() exits. *_mydata ends up pointing to garbage. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies&quo

Re: [pyxl] xlrd-0.8.0 .xlsx formatting_info=True not imlemented

2012-08-29 Thread John Yeung
ht provide the formatting info you need: http://packages.python.org/openpyxl/index.html http://pypi.python.org/pypi/openpyxl/1.5.8 John Y. -- http://mail.python.org/mailman/listinfo/python-list

Re: interfacing with x86_64 assembler

2012-09-01 Thread John Ladasky
I haven't seen this joke on the Net in years, does anyone still remember it? "C combines the power of assembly language with the readability and maintainability of assembly language." -- http://mail.python.org/mailman/listinfo/python-list

Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
pages/pdate says: "Unfortunately there is no easy way to parse full ISO 8601 dates using the Python standard library." It looks like this was taken out of "xml" at some point, but not moved into "datetime". John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
On 9/6/2012 12:51 PM, Paul Rubin wrote: > John Nagle writes: >> There's an iso8601 module on PyPi, but it's abandoned; it hasn't been >> updated since 2007 and has many outstanding issues. > > Hmm, I have some code that uses ISO date/time strings and just c

Re: ctypes - python2.7.3 vs python3.2.3

2012-09-07 Thread John Gordon
c char mydata[16]; That will solve the immediate problem, however it makes myfunction() non-reentrant. > (Btw.: I don't know why you use char ** _mydata, i would use > char * _mydata, but then again, i'm not very familiar with > ctypes) He uses char **

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread John Gleeson
On 2012-09-06, at 2:34 PM, John Nagle wrote: Yes, it should. There's no shortage of implementations. PyPi has four. Each has some defect. PyPi offers: iso8601 0.1.4 Simple module to parse ISO 8601 dates iso8601.py 0.1dev Parse utilities for is

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread John Nagle
On 9/8/2012 5:20 PM, John Gleeson wrote: > > On 2012-09-06, at 2:34 PM, John Nagle wrote: >> Yes, it should. There's no shortage of implementations. >> PyPi has four. Each has some defect. >> >> PyPi offers: >> >> iso8601 0.1.4 Simpl

Re: Python presentations

2012-09-13 Thread John Gordon
In andrea crotti writes: > For my experience if I only see code in slides I tend not to believe > that it works somehow Presumably you will have some credibility with your audience so they won't just assume you're making it up? I think slides would be fine.

Re: Installing Pip onto a mac os x system

2012-09-20 Thread John Gordon
In John Mordecai Dildy writes: > Now it shows the error of: > sudo: easy_instal: command not found Try 'easy_install' instead of 'easy_instal'. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for

Re: Print Function

2012-09-21 Thread John Gordon
version 3, print was changed into a function. Use this and it will work: print("Game Over") -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Go

Re: Reducing cache/buffer for faster display

2012-09-27 Thread John Gordon
y 1-2 > > min or so. > Yup! Just add a call to sys.stdout.flush() after each print. Isn't terminal output line-buffered? I don't understand why there would be an output delay. (Unless the "\r" is messing things up...) -- John Gordon

Re: How to get progress in python script.

2012-09-28 Thread John Gordon
't think file locking would be an issue. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Hello, We are looking for a qualified Sr. Python Developer for a job position in Bethesda, MD.

2012-10-10 Thread John Cook
Please let me know, if you might want to consider this progressive job opportunity and discuss the position details. Thank you for the thoughts. Regards, John Cook Team Recruiting Services Terra Health, Inc 5710 W. Hausman, Ste 108 San Antonio, TX 78249 P-210.424.4017 F-210.582.0084 C

Re: how to insert random error in a programming

2012-10-15 Thread John Gordon
In Debashish Saha writes: > how to insert random error in a programming? Open the program source file and replace the Nth character with a random character. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted

Re: Exception Messages

2012-10-15 Thread John Gordon
vCamError inherit __str__() from Exception? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: install pyOpenSSL in python2.7

2012-11-04 Thread John Gleeson
can get it on PyPI here http://pypi.python.org/pypi/pyOpenSSL SSLv2 is no longer supported in OpenSSL, and version 0.13 no longer expects it. - John -- http://mail.python.org/mailman/listinfo/python-list

Re: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-06 Thread John Gordon
In iMath writes: > how to get a list of names of everything in the current directory ? Try os.listdir() . -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Go

Re: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-13 Thread John Gordon
In Chris Angelico writes: > It yields it? You mean Google is an iterator? ITYM generator. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &

Re: Generate unique ID for URL

2012-11-13 Thread John Gordon
x27;docs.python.org/library/uuid.html') > 'ZG9jcy5weXRob24ub3JnL2xpYnJhcnkvdXVpZC5odG1s' > I would prefer more concise ID's. > What do you recommend? - Compression? Does the ID need to contain all the information necessary to recreate the original URL? -- John Gordon A is for Amy, who

Describing code with slides

2012-11-14 Thread John Graves
I'm trying to work out the best way to provide a description of some code in a set of presentation slides which can be played backward and forward through the bits that someone is trying to understand (rather than using a screencast -- where you can never seem to rewind just the right amount ...).

Re: Robust regex

2012-11-19 Thread John Gordon
ng = 'key_1|||value_1key_2|||value_2' pairs = string.split('') for pair in pairs: keyval = pair.split('|||') print '%s=%s' % (keyval[0], keyval[1]) -- John Gordon A is for Amy

Re: 10 sec poll - please reply!

2012-11-20 Thread John Gordon
In <3d71f175-164e-494c-a521-2eaa5679b...@googlegroups.com> Michael Herrmann writes: > What, in your view, would be the most intuitive alternative name? keyboard_input(). -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is

Re: List problem

2012-12-03 Thread John Gordon
In <8c0a3ea9-2560-47eb-a9c7-3770e41fe...@googlegroups.com> subhabangal...@gmail.com writes: > Dear Group, > I have a list of the following pattern, > [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), (= > 'Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'),

Re: Conversion of List of Tuples

2012-12-03 Thread John Gordon
n tup_list: for item in t: new_list.append(item) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.

Re: Conversion of List of Tuples

2012-12-03 Thread John Gordon
In subhabangal...@gmail.com writes: > Thanks. But I am not getting the counter "5posts 0 views"...if > moderator can please check the issue. I logged in via Google Groups and all the replies were present. What is your question? (This group is not moderated.)

Re: mini browser with python

2012-12-05 Thread John Gordon
hing else? What web standards does this mini browser need to support? Full HTML5? Partial HTML? CSS? Javascript? Flash? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edw

Installing packages on Mac OS X 10.7.5

2012-12-05 Thread John Dildy
Hello Everyone! I have python v2.7.1 and I am trying to install packages on the Mac OS X v10.7.5 I am trying to install: Distribute Nose virtualenv If anyone can help me that would be great John Dildy jdild...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: mini browser with python

2012-12-06 Thread John Gordon
In inq1ltd writes: > Right now I need some way to display > 15 to 20 lines of html in its own window or > as part of my screen. Could you open a shell window and run a text web browser such as Lynx? -- John Gordon A is for Amy, who fell down the stairs gor...@

Re: date-time comparison, aware vs naive

2012-12-10 Thread John Gordon
actual code you're using, instead of telling us about it. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: String manipulation in python..NEED HELP!!!!

2012-12-10 Thread John Gordon
to go about doing > that please help. def encode(plain): '''Return a substituted version of the plain text.''' encoded = '' for ch in plain: encoded += key[alpha.index(ch)] return encoded -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb compare lower

2012-12-11 Thread John Gordon
sql = 'UPDATE product SET price=%s WHERE LOWER(sku)=%s' cursor.execute(sql, (price, sku.lower()) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread John Gordon
; cursor.execute("""insert into interactions values(Null, %s, "Call Back", > %s)""" % (i_id, date_plus_2)) > and no cigar :( > Tom Have you tried using single-quotes around Call Back, instead of double quotes? I've noticed that SQL statements pre

Question regarding mod_python and a script for web.

2012-12-20 Thread John Pennington
e can point me in the right direction for solving this. Basically, the problem is this. we have a webform that collects data such as, NAME, SSN, EMAIL Address etc.. when the user hits submit, the uri posts to the query string like the folllowing: https://test.uchast.com/admit/supp.py?fname=john&

RE: Question regarding mod_python and a script for web.

2012-12-21 Thread John Pennington
Hi Ion thanks a bunch, for responding. The problem we seem to be running into is that When we change the forms to a post instead of a get I cannot pick up the post values using cgi: page_info = cgi.FieldStorage() is this a limitation of mod_python? Thanks. john Date: Thu, 20 Dec 2012 17:59

Re: Evaluate postgres boolean field

2013-01-04 Thread John Gordon
In andydtay...@gmail.com writes: > for row in cursor: > row_count += 1 > if row[4] = True > print row[1] Since row[4] is a boolean value, you should be able to just say: if row[4]: print row[1] --

Re: Need a specific sort of string modification. Can someone help?

2013-01-06 Thread John Ladasky
On Saturday, January 5, 2013 12:35:26 AM UTC-8, Sia wrote: > I have strings such as: > > tA.-2AG.-2AG,-2ag > > .+3ACG.+5CAACG.+3ACG.+3ACG Just curious, do these strings represent DNA sequences? -- http://mail.python.org/mailman/listinfo/python-list

Re: new to python and programming at large.

2013-01-09 Thread John Gordon
the method from itself. The argument to your method is called 'y' in the definition, but you refer to it as 'Y' in the return statement. Variable names are case-sensitive. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is f

Re: Why BOM in logging message?

2013-01-09 Thread John Gordon
: [etc...] I worked on an application that would insert a BOM in syslog messages if the logged message contained unicode, but not if it was plain ascii. Not sure if this relates to your issue, but it's similar enough that it seemed worth mentioning. -- John Gordon A is f

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread John Gordon
ar to have two very different versions of the tubecross table. One version has three fields (id, num, data) and the other version has at least four (station_code, SAJ, SPB, SOQ). Which one is correct? Also, what is the 'cursor_to' variable? It doesn't appear to be defined anywhere. --

Re: RIse and fall of languages in 2012

2013-01-10 Thread John Ladasky
On Wednesday, January 9, 2013 11:23:51 PM UTC-8, Steven D'Aprano wrote: > One should always be careful pronouncing a language dead or dying, No kidding! https://www.google.com/#q=is+fortran+still+used I usually use the query phrase "Why isn't Fortran dead yet?", but you get a better list of l

Re: Thought of the day

2013-01-14 Thread John Gordon
t the > expression was first used with years ago. Probably applies to just > about any technology. Including Java. Steven cleverly worded it in such a way as to apply directly to threads. The sentences are jumbled and interleaved, as if they were the output of two threads that are not synchroni

Re: Thought of the day

2013-01-16 Thread John Ladasky
On Sunday, January 13, 2013 8:16:29 PM UTC-8, Steven D'Aprano wrote: > A programmer had a problem, and thought Now he has "I know, I'll solve > two it with threads!" problems. Very nice! :^) This problem isn't exclusive to Python, however. Other multi-threaded applications can produce jumbled

Re: Uniquely identifying each & every html template

2013-01-18 Thread John Gordon
ml > nikos.html > cool.html > to HELP counter.py identify each webpage at a unique way. Instead of inserting unique content in every page, can you use the document path itself as the identifier? -- John Gordon A is for Amy, who fell down the stairs gor...@p

Re: Uniquely identifying each & every html template

2013-01-22 Thread John Gordon
key. (That seems fairly brittle though. For example if the disk crashes and is restored from a backup, the inodes could easily be different.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Using filepath method to identify an .html page

2013-01-22 Thread John Gordon
ml 0002 /home/files/steve/recipes/chocolate-cake.html0003 /home/files/mary/payroll.html 0004 -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
In <592233bd-3fc1-4e13-97f8-e11f89fbb...@googlegroups.com> Ferrous Cranus writes: > > pin int( htmlpage.encode("hex"), 16 ) % 1 > > > > It'll give you your number, but there are no guarantees of uniqueness. > You're looking at more blind random luck using that. > Finally!! THANK YOU VER

Re: Using filepath method to identify an .html page

2013-01-22 Thread John Gordon
In <4847a0e3-aefa-4330-9252-db08f2e99...@googlegroups.com> Ferrous Cranus writes: > And the .html files are not even close 10.000 You said you wanted a 4-digit number. There are 10,000 different 4-digit numbers. 0001 0002 ... 9999 -- John Gordon A is for

Re: Importing class from another file

2013-01-22 Thread John Gordon
ed Sub_Dir.My_Class Is there a file named __init__.py in Sub_Dir? A directory must contain that file in order to be considered a "module". (If you don't know what to put in the file, just leave it empty.) -- John Gordon A is for Amy, who fell down the stairs gor...@

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
187 cursor.execute( '''INSERT INTO visitors(pin, host , hits, useros, browser, date) VALUES(%s, %s, %s, %s, %s)''', (pin, hos t, 1, useros, browser, date) ) The INSERT statement gives six column names but only five placeholders (%s) in the VALUES clause. Perhaps

Re: Parse a Wireshark pcap file

2013-01-23 Thread John Evans
can't find it... I am not clear on how to point Python > > there... > > > "libdnet" is likely a shared object binary... What I /think/ you > are > missing is the Python library that interfaces with that binary... > > Could http://pypi.python.org/pypi/dnet answer the question? > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ > > -- > http://mail.python.org/mailman/listinfo/python-list > -- John Evans -- http://mail.python.org/mailman/listinfo/python-list

Re: Parse a Wireshark pcap file

2013-01-23 Thread John Evans
esync with "port selfupdate", then install the scapy port again. You should see not only the libdnet port installed, but also py27-libdnet, which is the missing glue you need for interfacing with libdnet. On Wed, Jan 23, 2013 at 9:01 AM, Kevin Holleran wrote: > > On Wed, Jan 23,

Re: Search log for string and display hourly/daily report

2013-01-23 Thread John Gordon
t: ", daily_instances This code assumes that log lines begin with a timestamp similar to "2013-01-23T09:27:01". If the timestamp is in a different format, or occurs elsewhere in the line, you'll have to adjust for that. -- John Gordon A is for Amy,

Re: Arent these snippets equivalent?

2013-01-23 Thread John Gordon
valent to me (in terms of control flow). But in the second example the fp.read() statement is duplicated, which is undesirable. It would be all too easy for a maintenance programmer to go into the code a year from now and change the first one but miss the second one. -- John Gordon

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

2013-01-24 Thread John Gordon
> complete/auto correct. Try PyScripter. http://code.google.com/p/pyscripter/ -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashly

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

2013-01-24 Thread John Gordon
In Sharwan Joram writes: > use vim. He said he wanted autocomplete. Does Vim have that? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gas

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread John Gordon
a a meaningful name (usually a string.) Dictionaries do not preserve the order in which items are created (but there is a class in newer python versions, collections.OrderedDict, which does preserve order.) Example: >>> person = {} # start with an empty dictionary >>

Re: search google with python

2012-01-25 Thread John Nagle
s an API, but you have to ask to use it. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

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

2012-01-25 Thread John O'Hagan
His Rantingness has already widened the scope of his spampaign to include the world's lexicographers and the billion or so English speakers they represent, with the aim of liberating them all from their sad misapprehensions about what constitutes valid colloquial English, and by example, t

Re: Weird newbie question

2012-01-26 Thread John Gordon
version 2.x (and 1.x for that matter), "print" is a statement, but it was changed to be a function in python version 3.x. In other words, in python 2.x you can say this: print x print "hello there" But in python 3.x you have to do it a little differently: print(x) pri

Re: Where to put data

2012-01-27 Thread John Nagle
ve some modules which contain nothing but big constants, written by a program in Python format. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: calling a simple PyQt application more than once

2012-01-27 Thread John Posner
pp.exec_() You can click the "Press me" button as many times as you wish; it retrieves and displays/prints the same HTML file on each click. HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: calling a simple PyQt application more than once

2012-01-29 Thread John Posner
in range(SEVERAL_TIMES): # Get a file-like object for the Python Web site's home page. f = urllib.urlopen(WEBPAGE) # Read from the object, storing the page's contents in 's'. s = f.read() f.close() print s Best, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread John Roth
On Jan 30, 3:43 pm, Terry Reedy wrote: > On 1/30/2012 4:30 PM, Roy Smith wrote: > > > Every so often (typically when refactoring), I'll remove a .py file > > and forget to remove the corresponding .pyc file.  If I then import > > the module, python finds the orphaned .pyc and happily imports it. >

Re: Disable use of pyc file with no matching py file

2012-02-01 Thread John Roth
On Jan 31, 4:43 pm, Terry Reedy wrote: > On 1/31/2012 3:20 PM, John Roth wrote: > > > On Jan 30, 3:43 pm, Terry Reedy  wrote: > >> On 1/30/2012 4:30 PM, Roy Smith wrote: > > >>> Every so often (typically when refactoring), I'll remove a .py file > >

Re: copy on write

2012-02-01 Thread John O'Hagan
er both + and += should succeed, or both should fail. > > ~Ethan~ This also happens for tuples, sets, generators and range objects (probably any iterable), AFAIK only when the left operand is a list. Do lists get special treatment in terms of implicitly converting the right-hand operand? The

Re: copy on write

2012-02-02 Thread John O'Hagan
On Thu, 2 Feb 2012 01:34:48 -0500 Devin Jeanpierre wrote: > On Wed, Feb 1, 2012 at 10:18 PM, John O'Hagan > wrote: > > On Fri, 13 Jan 2012 10:40:47 -0800 > > Ethan Furman wrote: > > > >> Steven D'Aprano wrote: > >> > Normally this is harm

Re: copy on write

2012-02-02 Thread John O'Hagan
On 02 Feb 2012 09:16:40 GMT Steven D'Aprano wrote: > On Thu, 02 Feb 2012 19:11:53 +1100, John O'Hagan wrote: > > > You're right, in fact, for me the surprise is that "t[1] +=" is > > interpreted as an assignment at all, given that for lists (and other

Re: copy on write

2012-02-02 Thread John O'Hagan
On Thu, 02 Feb 2012 12:25:00 -0500 Terry Reedy wrote: > On 2/2/2012 9:17 AM, John O'Hagan wrote: > > > It's not so much about the type of x but that of x[1]. Wouldn't it > > be possible to omit the assignment simply if the object referred to > > by x[1]

Re: Killing threads, and os.system()

2012-02-03 Thread John Nagle
e of subprocesses where, in other languages, you'd use threads. Of course, you load a new copy of the interpreter in each thread, so this bloats memory usage. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: copy on write

2012-02-03 Thread John O'Hagan
On 03 Feb 2012 05:04:39 GMT Steven D'Aprano wrote: > On Fri, 03 Feb 2012 14:08:06 +1100, John O'Hagan wrote: > > > I think we're 12 years late on this one. It's PEP 203 from 2000 and > > the key phrase was: > > > > "The in-place function

Re: Common LISP-style closures with Python

2012-02-04 Thread John O'Hagan
gt;>> h() 2 >>> h() 3 >>> j() 1 >>> j() 2 >>> j() 3 This way, you can also write to the attribute: >>> j.count = 0 >>> j() 1 John -- http://mail.python.org/mailman/listinfo/python-list

Help with COM_error

2012-02-06 Thread John Lay
ave been unable to find any documentation on it. Can anyone help with the com errors? What do they mean? How do I resolve them? Any help would be appreciated. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
le "myfile.txt"), python will attempt to open that file starting from the current working dir. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey,

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
In <9bfb3e39-2bc6-4399-90cc-1c53aa062...@h6g2000yqk.googlegroups.com> smac2...@comcast.net writes: > xls_files = glob.glob(in_dir + "*.xls") You may want to put a directory separator character in between the directory name and the filename glob patter

Re: MySQLdb not allowing hyphen

2012-02-08 Thread John Nagle
You are doing it wrong. Do NOT use the "%" operator when putting SQL queries together. Let "cursor.execute" fill them in. It knows how to escape special characters in the input fields, which will fix your bug and prevent SQL injection. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: changing sys.path

2012-02-08 Thread John Nagle
t sys first. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Software tool for stochastic simulation as well as for the stochastic optimization

2012-02-09 Thread John Oksz
suggest ... Matlab ... python ... something else? Any thoughts would be appreciated, John -- http://mail.python.org/mailman/listinfo/python-list

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