Re: Target WSGI script cannot be loaded as Python module.

2018-05-23 Thread John Gordon
geopip2 > and they were installed successfully. Is your web server using Python 2 or Python 3 to execute WSGI? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gor

Re: Detection of ultrasonic side channels in mobile devices with Python?

2018-02-28 Thread John Gordon
channels from neuromodulating human behavior. > Should be easy to find some whack-job newsgroups that would love to > discuss that aspect of it. Sounds like the plot to the latest Kingsman movie. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread John Gordon
ue, but I can imagine situations where the same sort of thing could apply to code. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gash

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread John Gordon
In <151517608506.368831.5093080329614058603@welt.netz> "Kim of K." <k...@korea.gov> writes: > print(emo('now you see emos')) > OF COURSE THIS SHIT DOES NOT WORK. What device did you run this on? Your average terminal window isn't going to suppor

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread John Gordon
everything is crap. Why should software be any different? -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: errors with json.loads

2017-09-20 Thread John Gordon
ng, bytes, or bytearray. > In [24]: type(text) > Out[24]: str > So "text" seems to be a string. Why does json.loads return an error? Because, although text is the right type, it does not contain a valid json string. -- John Gordon A is for Amy, who fell

Re: Case-insensitive string equality

2017-08-31 Thread John Gordon
Modify the environment so that the mistake simply can't happen (or at least happens much less frequently.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "Th

Re: Proposed new syntax

2017-08-10 Thread John Gordon
if x < 5 for y in (100, 200)] [100, 101, 102, 103, 104, 200, 201, 202, 203, 204] -- 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

Re: get value from list using widget

2017-07-05 Thread John Gordon
ser, that allows the user to select a value? Or do you actually mean that *you* want to select a value in your code? I could go on, but you get my point. We need lots more information before we can even begin to help you. -- John Gordon A is for Amy, who fell down the sta

Re: how to add new tuple as key in dictionary?

2017-07-05 Thread John Gordon
]} > groupkey[tuple([0,3])] = groupkey[tuple([0,3])] + [[0,1]] The right-hand side of your expression is rightly complaining that groupkey[(0,3)] doesn't exist. Would you expect to say a = a + 1 When a doesn't exist? Your code tries to do much the same thing. -- John Gordon

Re: Visit All URLs with selenium python

2017-04-13 Thread John Gordon
at you expected, and then printing each url in the loop? -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Quick questions about globals and database connections

2017-04-05 Thread John Gordon
be even better to return conn, as that would allow updatedb() to call conn.disconnect(). -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-13 Thread John Gordon
, instead of adding each field individually. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add months to a date (datetime object)?

2017-02-06 Thread John Gordon
n; it is an answer in response to the original post asking how to add months to a datetime object. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread John Gordon
rd = raw_input("Password: ") If it doesn't need to be interactive, you could require that the user supply a file in the current directory containing the username and password. -- John Gordon A is for Amy, who fell down the stairs gor...@pani

Re: Using python to start programs after logging in

2017-01-20 Thread John Gordon
builtin facilities then all > programs will be started on the same virtual desktop and I want to > start them on different ones. The window manager doesn't allow you to specify a target desktop? That seems like a pretty heinous feature omission. -- John Gordon A is for

Re: Using python to start programs after logging in

2017-01-19 Thread John Gordon
indow manager's built-in facilities for starting programs would be better. Why are you using Python instead? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &q

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-14 Thread John Gordon
In <ebbvoaf750...@mid.individual.net> Gregory Ewing <greg.ew...@canterbury.ac.nz> writes: > Once you're in the clutches of Apple, there is no Escape. Ha! -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, ass

Re: Install Problem

2016-12-13 Thread John Gordon
that the python35.dll doesn't exist on my >computer so it can't open Python. How can this problem be fixed? When does the error occur? During installation? Or after installation when you're trying to run a python program? What version of Windows do you have? -- John Gordon

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread John Gordon
ot override the class attribute, then you can use whichever one you prefer. self.class_attr may be more convenient because you don't have to provide a specific class name. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B i

Re: calling a program from Python batch file

2016-12-07 Thread John Gordon
Pexpect is a pure Python module for spawning child applications; controlling them; and responding to expected patterns in their output. Pexpect allows your script to spawn a child application and control it as if a human were typing commands. https://pex

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread John Gordon
cat $HOME/file.txtERROR No file named '$HOME/file.txt' vi $(grep -l foo *.txt) ERROR No file named '$(grep -l foo *.txt)' None of these commands would work if bash didn't "alter the input going to another program". -- John Gordon A is for Amy, who fell

Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
st_string) > result=json.loads(r.content) You're using http: instead of https:, and you're using ?katty instead of ?name=katty, and therefore the host does not recognize your request as an API call and redirects you to the normal webpage. -- John Gordon A is for Amy, who

Re: Can json.dumps create multiple lines

2016-12-01 Thread John Gordon
"with several strings", > "as a demo" > ]' json.dumps() has an 'indent' keyword argument, but I believe it only enables indenting of each whole element, not individual members of a list. Perhaps something in the pprint module? -- John Gordon

Re: Python while loop

2016-11-30 Thread John Gordon
ame; you could have called it "hamburger" and python would treat it just the same. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: MemoryError and Pickle

2016-11-21 Thread John Gordon
fileObject.write("ua: %s\n" % parts[2]) fileObject.close() But this doesn't use pickle format, so your reader program would have to be modified to read this format. And you'll run into the same problem if the reader expects to keep all the data in memory. -- John Gordon

Re: Parsing a single-level JSON file

2016-11-18 Thread John Gordon
In <o0nhh5$i5q$1...@reader2.panix.com> John Gordon <gor...@panix.com> writes: > In <b9f6b419-7923-4c51-ba0d-c3bed68b0...@googlegroups.com> > mike.rei...@gmail.com writes: > with open("json.dat", "r") as fp: > data = json.load(fp)

Re: Parsing a single-level JSON file

2016-11-18 Thread John Gordon
sure how to target it to go > to MyField1 and get "id" value. That data looks like a list of dictionaries: import json with open("json.dat", "r") as fp: data = json.load(fp) for item in data: if item['name'] == 'myField2'

After import, some submodules are accessible and some aren't

2016-10-28 Thread John Gordon
tribute 'modlist' >>> ldap.dn >>> import ldap.modlist >>> ldap.modlist Why the difference? -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: exist loop by pressing esc

2016-10-24 Thread John Gordon
In <6e030fd0-93c1-4d23-8656-e06c411b6...@googlegroups.com> chris alindi <alindikri...@gmail.com> writes: > simple while loop range(10) if user press esc exits loop range() is typically used with for loops, not while loops. what is your while condition? what use is the range() v

Re: How to handle errors?

2016-10-22 Thread John Gordon
his code: > #!/usr/bin/env python > import sys > print sys.argv > Then I ran it: > ~$ python test.py argument1 argument2 > ['test.py', 'argument1', 'argument2'] Options cannot be passed *on the hash-bang line*. -- John Gordon A is for Amy, who fell do

Re: How to handle errors?

2016-10-20 Thread John Gordon
In <8500044a-c8d1-43ad-91d9-e836d52bd...@googlegroups.com> SS <sami.st...@gmail.com> writes: > I would like to be able to handle that error a bit better. Any ideas? Wrap the socket.gethostbyname() call in a try/except block. -- John Gordon A is for Amy

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In <9d24f23c-b578-4029-ab80-f117599e2...@googlegroups.com> Sayth Renshaw <flebber.c...@gmail.com> writes: > So why can't i assign the result slice to a variable b? Because shuffle() modifies the list directly, and returns None. It does NOT return the shuffled list.

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
fle to give me my numbers? a = [1,2,3,4,5] shuffle(a) print(a[:3]) -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Build desktop application using django

2016-10-17 Thread John Gordon
e term "desktop application" generally means something which runs locally on your computer, such as Microsoft Word or a game. But Django is for building websites, not local applications. So Django probably isn't what you want. -- John Gordon A is for Amy, who

Re: Free Python e-books from O'Reilly

2016-10-10 Thread John Gordon
of time > and memory space. I downloaded several of them and noticed that they were all fairly short, none more than 80 pages or so. I suspect these books are somewhat lighter fare than the typical O'Reilly tome. Not necessarily a bad thing, but worth mentioning. -- John Gordon

Re: xml parsing with lxml

2016-10-07 Thread John Gordon
? root = doc.getroot() for child in root: print(child.tag) -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: how to append to list in list comprehension

2016-09-30 Thread John Gordon
nd(0) Or, if you really want to use a list comprehension: [f.append(0) for f in fups if len(f) < 5] However there's no reason to use a list comprehension here. The whole point of list comprehensions is to create a *new* list, which you don't appear to need; you just need to modify t

Re: Why does the insert after list function fail?

2016-09-22 Thread John Gordon
thing; it modifies the existing list in-place. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: strings and ints consistency - isinstance

2016-09-21 Thread John Gordon
> int(3.0) however you cannot do a non string with str(a). Anything you type can be represented as a string*. The same is not true for integers. * Okay, python 2.7 does have some issues with Unicode. -- John Gordon A is for Amy, who fell down the stairs gor...@pan

Re: Requests for webbrowser module

2016-09-14 Thread John Gordon
of using the current window. Providing There is an internal setting within Chrome that controls whether new pages are opened in a new tab or a new window. Perhaps that is your issue? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is

Re: How to extend a tuple of tuples?

2016-09-12 Thread John Gordon
at idea? It has been mutated in the very statement that > you are quoting No. An entirely new tuple is created, and 'a' is rebound to it. The existing tuple is not mutated. -- John Gordon A is for Amy, who fell down the stairs gor...@pan

Re: memberof example using ldap

2016-09-12 Thread John Gordon
mberof=CN=YourGroup,OU=Users,DC=YourDomain,DC=com)) > The above query doesn't work fine even if group doesn't exist, > It always says that user is member of The query returns a user who is not a member of the named group? That's odd. What is the search base and scope? -- John Gordon

Re: ldap or active directory module

2016-09-09 Thread John Gordon
ists, otherwise it doesn't. > also another function to find the user in a particular group Do the same search as above, returning the "member" attribute. Get the search result and then inspect the list of returned members. -- John Gordon A is for Amy, who fell down

Re: Mysterious Logging Handlers

2016-09-09 Thread John Gordon
t isn't defined anywhere. That is the default logging format; it's used when you haven't supplied any format of your own. The snippet of xlreader.py does not define any format, so it seems like that's where it's coming from. (This seems pretty straightforward; am I missing something?) -- John Gordon

Re: How to split value where is comma ?

2016-09-08 Thread John Gordon
nchanged. You want something like this instead: newlist = a.split(",") for x in newlist: print(x) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edwar

Re: JSON result parsing

2016-07-29 Thread John Gordon
anks for all suggestions! if len(results) == 1 and 'ID' in results: return results['ID'] else: return 'something else' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: what the heck this code is doing?

2016-07-01 Thread John Gordon
loops through the child items in entry, looking for one with a 'key' value of 'Track ID'. If it finds one, it sets found=True and loops one more time, returning the text of the *next* child element. It depends on the 'key' element being directly followed by the 'integer' element within entry. --

Re: Break and Continue: While Loops

2016-06-23 Thread John Gordon
y goes up to 4? Your code prints i and THEN adds one to it. So i is 4, it gets printed, then 1 is added to it, so it becomes 5 and then the loop exits. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bear

Re: while Loops

2016-06-22 Thread John Gordon
o the loop will keep going at 5, and only stop when i is 6. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: how to for loop append a list [] when using parallel programming

2016-06-15 Thread John Gordon
a more specific answer, ask a more specific question. -- 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" -- https://mail.python.or

Re: log file.

2016-06-14 Thread John Gordon
asking for help with logging, or communicating with the pump? -- 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" -- https://mail.py

Re: how to solve memory

2016-06-10 Thread John Gordon
r name, no this name > is your name changed in previous post? My comment was that the recursive calls weren't indented in the "if deep > 0" block, therefore DFS was being called infinitely with smaller and smaller values of deep. But it appears you have fixed that issue. -- John G

Re: how to solve memory

2016-06-10 Thread John Gordon
In <4f853aa2-cc00-480b-9fd7-79b05cbd4...@googlegroups.com> meInvent bbird <jobmatt...@gmail.com> writes: > https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing I already responded to your earlier post about this program. Did you read it?

Re: why it is like stop running after a 3 seconds

2016-06-09 Thread John Gordon
f deep > 0:" at the top of the function, but the recursive calls aren't inside that if block. DFS keeps calling itself with smaller and smaller values of deep. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B i

Re: Unit test a class with xml elements

2016-05-24 Thread John Gordon
of class? > XML binding is used here. > Share if any examples available. Create your own sample XML illustrating each desired combination. Then write test cases for each. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is

Re: ZipImportError: can't find module

2016-05-24 Thread John Gordon
or from a cron job? Are the permissions on the zipfile correct, and all parent directories? How, specifically, are you importing the module? Are you doing something like this: zipfile = zipimport.zipimporter('file.zip') zipfile.load_module('mymodule') -- John Gordon A is

Re: Program prints questions for user input, but won't show the answer output

2016-05-18 Thread John Gordon
hile counter < 7: > if (pints[counter] < lowPints): > lowPints = pints[counter] > counter = counter + 1 > return lowPints And getLow() has a very similar problem. I suspect you want to unindent the 'counter = counter +

Re: Python 3.5.1 Not Working

2016-05-13 Thread John Gordon
ng Windows XP? Unfortunately, versions of Python above 3.4.3 do not support Windows XP. You'll have to download version 3.4.3 if you are using Windows XP. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Simplest way to locate a string in a column and get the value on the same row in another column

2016-04-28 Thread John Gordon
. Are you talking about a spreadsheet, a database table, an HTML table, or something else? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlyc

Re: Python path and append

2016-04-25 Thread John Gordon
f_out.close() os.rename('win.txt', 'win_old.txt') os.rename('win_new.txt', 'win.txt') -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Pyscripter Issues

2016-03-31 Thread John Gordon
: 32-bit or 64-bit? I vaguely recall that PyScripter won't work with the 64-bit version. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlyc

Re: Not downloading

2016-03-23 Thread John Gordon
install? Python 3.5 is known to have trouble installing on Windows XP. If you have Win XP, try using an older 3.4 version of Python. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: from a module return a class

2016-03-19 Thread John Gordon
le, it wouldn't be callable. It has to be a function or a class. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: from a module return a class

2016-03-19 Thread John Gordon
tUser_PWord.py", line > 58 > return user_pword > SyntaxError: 'return' outside function Show us the complete definition of promptUser_PWord(). -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: from a module return a class

2016-03-18 Thread John Gordon
an't work if promptUser_PWord is a module; modules aren't callable. promptUser_PWord() has to be a function or a class. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edw

Re: from a module return a class

2016-03-18 Thread John Gordon
ever encounters the > TypeError: 'module' object is not callable. Good point; I hadn't thought of that. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &

Re: password and username code

2016-03-06 Thread John Gordon
../,%. What is your process for finding out if a name is registered? There are lots of possible ways to do it. Do you have one in mind? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: list reversal error

2016-03-03 Thread John Gordon
valuates to j = len(data) which would yield 5 for a five-element list, but the last actual element is in data[4]. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: Continuing indentation

2016-03-03 Thread John Gordon
rmissible may not be desirable. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
thing named 'hexdump'. Have you inspected the 'utilities' module? Does it, in fact, contain something named 'hexdump'? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Ed

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
'utilities' module? Does it, in fact, contain > > something named 'hexdump'? > Yes In that case, the problem is most likely a circular import issue, as you mentioned. The only way to fix it is to reorganize your modules. How did this error come up? Did the code

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
new module, and change the statements that import those things. You shouldn't have to rewrite any of the actual code. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: Question about a class member

2016-01-07 Thread John Gordon
in the _BaseHMM class, from which GaussianHMM inherits.) -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
/private directory is not navigable? Does it even show up as a choice? Is there something special about the /private directory? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
he temporary file when it's originally created? -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread John Gordon
l last) > in () > > 1 sum(expectation_A)[0] > IndexError: invalid index to scalar variable. > // The built-in function sum() returns a single value, not a list, so this is a reasonable error. I suspect the code actually intended to call numpy.sum(), which does return

Re: imshow keeps crashhing

2015-12-22 Thread John Gordon
this program is stored in the environment variable SCIPY_PIL_IMAGE_VIEWER. If that variable is not present, it uses 'see' by default. Do you have a suitable image viewing program installed on your computer? If so, try setting the SCIPY_PIL_IMAGE_VIEWER environment variable to the name of that program. -

Re: error reading api with urllib

2015-12-16 Thread John Gordon
. Try doing that. (It works in your browser because it defaults to GET automatically.) -- 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 T

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread John Gordon
O IT!". In fact, in python there is almost always *MANY* ways to > achieve the same output.=20 The koan reads: There should be one-- and preferably only one --obvious way to do it. You left out the rather important word "obvious". -- John Gordon A is for Am

Re: if else python

2015-11-26 Thread John Gordon
'else' branches both execute? Your if/else branches are in a loop, so perhaps you're seeing the 'if' branch on one loop iteration, anf the 'else' branch on the next iteration? I see that your if and else branches both contain a screen.addstr() call. Are you seeing both of the

Re: Finding scores from a list

2015-11-24 Thread John Gordon
sage instead : > Traceback (most recent call last): > File "<pyshell#62>", line 1, in > print((results["gengyang"])["score"]) > TypeError: list indices must be integers, not str Lists are indexed by number, not by name. You want something like

Re: anyone tell me why my program will not run?

2015-11-22 Thread John Gordon
tailscount += 1 Perhaps you meant to have this piece of code indented under the while loop above? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "

Re: What is a function parameter =[] for?

2015-11-18 Thread John Gordon
ed without an argument for list0, it will use [] as the default value. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there any reason to introduce this intermediate variable (sz)?

2015-11-17 Thread John Gordon
accepts an 'int or sequence of ints', so you don't specifically need a sequence. Is the same true for the 'size' keyword argument of np.random.normal()? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, ass

Re: Is there any reason to introduce this intermediate variable (sz)?

2015-11-17 Thread John Gordon
to read. Using sz can also lead to easier code maintenance. If the contents of the tuple were ever to change, it would be much easier to simply change it in once place (the definition of sz), rather than having to edit several different occurrences of (n_iter,) in your code.

Re: Is it useful for re.M in this example?

2015-11-12 Thread John Gordon
he reason to put re.M in the example project: That's because your sample string does not contain newline characters. If it did, you would see the effect of re.M. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basi

Re: Why does 'as' not recognized?

2015-11-12 Thread John Gordon
s[2] > SyntaxError: invalid syntax > >>> as=cats > SyntaxError: invalid syntax > >>> as > SyntaxError: invalid syntax 'as' is a python language keyword, and cannot be used for variable names. -- John Gordon A is for Amy, who fell down the stairs g

Re: new to python, help please !!

2015-11-11 Thread John Gordon
update their values when i gets incremented, but it doesn't work like that. When you increment i, you also have to reassign s1 and s2. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: How to handle exceptions properly in a pythonic way?

2015-11-02 Thread John Gordon
n arise during execution of the > requests.get(url)? The best way is probably to do nothing at all, and let the caller handle any exceptions. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: If one IF is satisfied, skip the rest in the nest...

2015-10-21 Thread John Gordon
three of your if statements start out with this condition: if wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and wb1_sheet1.cell(row=cell + 1, column=3).value == 0 So you could reorganize your code by putting an if statement at the top that only checks this condition. Then, indented underneath, you

Re: Trouble running

2015-10-06 Thread John Gordon
e help? > Cameron We need more details to help you. What program are you using to try to save? Is it a text editor? What happens when you try to save? How do you know it didn't work? Do you get an error message? -- John Gordon A is for Amy, who fell down the

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
nderstand that, I don't believe that you cannot figure out how to Certainly we can understand it. But it takes ever-so-slightly more effort to do so. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
ithout using the concept of "not"? I wasn't commenting directly to the "ask not..." quote; I was referring upthread to the choice between not 0 <= x <= 10 and x < 0 or x > 10 Both are of course understandable, but in my opinion, the latter

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
ore visual". In my opinion, when comparing a variable to a constant, it's more natural to have the variable on the left and the constant on the right, so that's one strike against this code. Another strike is that the code isn't consistent with itself; it puts the variable on the left in the first

Re: Check if a given value is out of certain range

2015-09-30 Thread John Gordon
In <mugaov$79k$1...@speranza.aioe.org> alister <alister.nospam.w...@ntlworld.com> writes: > I would stick with the OP's current solution > Readability Counts! I agree. 'if x < 0 or x > 10' is perfectly fine. -- John Gordon A is for Amy, who

Re: Question re class variable

2015-09-29 Thread John Gordon
t at the same time. If an object is created and destroyed and then another new object is created, the ID of those two objects can be the same. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Django (Python Web Framework) Tutorial

2015-09-26 Thread John Gordon
oject code in a subdirectory of your home directory. That should be fine. -- 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: Learning Modules, Arguments, Parameters (imma noob)

2015-09-24 Thread John Gordon
lo. The updated code would look like this: def main(): kilo = get_input() convert_kilo(kilo) def get_input(): kilo = float(input('Enter Kilometers: ')) return kilo def convert_kilo(kilo): miles = float(kilo * 0.6214) print( kilo,' kilometers conver

Re: Problem configuring apache to run python cgi on Ubuntu 14.04

2015-09-21 Thread John Gordon
may not be your problem, as you haven't told us exactly what is going wrong. -- 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&

  1   2   3   4   5   >