Re: [Tutor] which of these is more efficient?

2019-08-19 Thread Alan Gauld via Tutor
On 19/08/2019 00:55, nathan tech wrote: > Is this an efficient method compared to 1? Efficient in what sense? The amount of code to write? The amount of computing resources used? The speed - and does that matter in an interactive game like this? -- Alan G Author of the Learn to Program

Re: [Tutor] python question

2019-08-18 Thread Alan Gauld via Tutor
s. What the question does not specify is what the function should return if there are no members found. I would assume an empty list... To do this you will need some kind of loop and a test and build a list. If you know about list comprehensions that might be one option. (If you don't, use a

Re: [Tutor] What is Tuple in the typing module?

2019-08-17 Thread Alan Gauld via Tutor
be fair, may not always be possible/easy). They are also an attempt to bring some of the "benefits" of static typing into Python but with very limited success. But they are only hints, you can happily survive without them. -- Alan G Author of the Learn to Program web site http://www.alan-

Re: [Tutor] Search for Text in File

2019-08-15 Thread Alan Gauld via Tutor
rs found = 4, out of 20 runs. > > RMSD TABLE > __ And this is the only line containing your string so, even if your code worked, this is the only line you would locate. It doesn't look very useful... > Everything that I have tried returns 'TypeError: 's

Re: [Tutor] HELP PLEASE

2019-08-13 Thread Alan Gauld via Tutor
t recent call last): >>> File "/Applications/Python 3.7/exercises .py", line 37, in >>>main() Based on the file name I suspect she is already doing some kind of tutorial. However, you are right about needing to review some of the basic concepts. As a plug I'll just

Re: [Tutor] Fwd: Re: HELP PLEASE

2019-08-12 Thread Alan Gauld via Tutor
On 12/08/2019 19:35, Alan Gauld via Tutor wrote: > To save some typing convert the?? int conversion loop into a function: > > > def?? to_ints(strings): > ?? num_copy = [] > ?? for num in nums: > num_copy.append(float(num)) > > ?? retur

[Tutor] Fwd: Re: HELP PLEASE

2019-08-12 Thread Alan Gauld via Tutor
Forwarding to tutorblist for info... Forwarded Message Subject:Re: [Tutor] HELP PLEASE Date: Mon, 12 Aug 2019 19:34:48 +0100 From: Alan Gauld Reply-To: alan.ga...@yahoo.co.uk To: Marissa Russo On 12/08/2019 19:17, Marissa Russo wrote: > I fixed s

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Alan Gauld via Tutor
rt statistics as stats ... print("The mean of the first file is: ", stats.mean(data[0]) ) ... That should be enough to be getting on with. Once you get those things done you could post again and we might suggest some ways to tidy the code up a little. -- Alan G Author of the Learn to Progr

Re: [Tutor] Object creation query

2019-08-10 Thread Alan Gauld via Tutor
fort. In this case quite a lot more effort. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maill

Re: [Tutor] Object creation query

2019-08-09 Thread Alan Gauld via Tutor
n attribute "name" or "Type" or similar? That should greatly simplify your code. If that's not what you mean by the same structure you need to give us a little more detail. Not necessarily the full descriptions but some simplified examples maybe? -- Alan G Author o

Re: [Tutor] Name for this type of class?

2019-08-04 Thread Alan Gauld via Tutor
On 04/08/2019 09:15, Alan Gauld via Tutor wrote: >>> Classes should never be named for their data but for their function. > I was not suggesting that a class name should be a verb, I think my biggest mistake here was the use of the word "function" which, in a programming

Re: [Tutor] Name for this type of class?

2019-08-04 Thread Alan Gauld via Tutor
er design, not what its internal data is. (A related guideline is that classes should not be called "xxxManager" - objects should manage themselves.) The purpose of these guides is to focus people's minds on objects(active entities) rather than data because focusing o

Re: [Tutor] Name for this type of class?

2019-08-03 Thread Alan Gauld via Tutor
t should just be a module. (There are a very few genuine singleton use cases though, so it's not a cast iron rule.) HTH. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr

Re: [Tutor] Name for this type of class?

2019-08-02 Thread Alan Gauld via Tutor
it support. Does the internal data support those operations? Or is it really several classes conflated into one for "convenience"? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at:

Re: [Tutor] just a quick logic check if someone has two seconds

2019-08-01 Thread Alan Gauld via Tutor
d when do_test returns. You only ever have one at a time during the execution of do_test(). You have a total of 3 during your programs lifetime. (or however many times you click the button!) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/

Re: [Tutor] Create Logging module

2019-08-01 Thread Alan Gauld via Tutor
tFormatter(formatter) > > stream_handler = logging.StreamHandler() > stream_handler.setLevel(log_console_level) > stream_handler.setFormatter(formatter) > > logger.addHandler() > logger.addHandler(stream_handler) > > #this wraps is to make sure we ar

Re: [Tutor] Difference between decorator and inheritance

2019-08-01 Thread Alan Gauld via Tutor
e it thee, if you want to dig into the inner mechanisms then ask for more details. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.c

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-31 Thread Alan Gauld via Tutor
f it is important to know that the data has changed (for any reason, not just data corruption) then use a checksum. Certainly if it's publicly available or you plan on shipping it over a network a checksum is a good idea. -- Alan G Author of the Learn to Program web site http://www.alan-g.me

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread Alan Gauld via Tutor
data. No it doesn't! You are quite likely to get a successful calculation using nonsense data and therefore invalid results. But they look valid - a number is a number... Checking data integrity is what checksums are for. -- Alan G Author of the Learn to Program web site http://www.a

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread Alan Gauld via Tutor
e program execution. It all depends on how much data?, how often it is used?, how often would it be calculated? How long does the process run for? etc. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr

Re: [Tutor] REQUIRED SUPPORT FOR CODE

2019-07-25 Thread Alan Gauld via Tutor
What kind of database? How do you anticipate this would work? Give us some examples? # -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauld

Re: [Tutor] Fw: CSC1010H 4th assignment

2019-07-25 Thread Alan Gauld via Tutor
our homework for you. We expect to see your effort and a specific question that we can answer. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldpho

Re: [Tutor] pass arg to list

2019-07-18 Thread Alan Gauld via Tutor
statements) and your full execution output, including whree you call the program. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] Calling a C shared library with PyObject

2019-07-17 Thread Alan Gauld via Tutor
main python list where there will likely be far more experts available. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _

Re: [Tutor] Lengthy copyright notices?

2019-07-17 Thread Alan Gauld via Tutor
least if they do need to. For example, in my last book the publishers required me to get a disclaimer from the author of some open source files even though they clearly stated they could be used for any purpose. Having the copyright notice with email link made that easy. -- Alan G Author of the

Re: [Tutor] Unit testing: Just the API or internal use only methods, too?

2019-07-16 Thread Alan Gauld via Tutor
I but not necessarily for the internal/private methods. You should definitely test all code you write, but how formally you test the private stuff is up to you. But publishing the public API tests allows clients to run them too. -- Alan G Author of the Learn to Program web site http://www.alan-g.me

Re: [Tutor] raising exceptions in constructor code?

2019-07-16 Thread Alan Gauld via Tutor
ything that would merit an exception. __new__ pretty much just sets up the structure of the object ready for initialisation by __init__. Incidentally, this two stage construction/initialisation is also found in other OOP languages like Smalltalk and Objective C (and Lisp?). -- Alan G Author of th

Re: [Tutor] Reading .csv data vs. reading an array

2019-07-16 Thread Alan Gauld via Tutor
x tools now that scripting languages like perl/python/ruby exist. But for line by line file processing it is superb. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at

Re: [Tutor] Lengthy copyright notices?

2019-07-15 Thread Alan Gauld via Tutor
stuff to a separate file - too easy to get lost. But I certainly don't want it in my help() output either. A comment solves both for the downside of some initial scrolling when reading or editing the file -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www

Re: [Tutor] Reading .csv data vs. reading an array

2019-07-15 Thread Alan Gauld via Tutor
mething like this; > > with open("/path/to/datafile", "r") as f: > for line in f: > if REDFLAGTEXT in line: # skip these > continue > do-something-with line All true, but sed - once you get used to it! - is easier IMHO and usuall

[Tutor] Fwd: RE: pointers or references to variables or sub-sets of variables query.

2019-07-15 Thread Alan Gauld via Tutor
Forwarding to list Forwarded Message Subject:RE: [Tutor] pointers or references to variables or sub-sets of variables query. Date: Mon, 15 Jul 2019 17:13:23 +1000 From: mhysnm1...@gmail.com To: 'Alan Gauld' All, Sorry for the late respon

Re: [Tutor] Web framework module for Python.

2019-07-15 Thread Alan Gauld via Tutor
t more than the very basics then something like Flask would make life easier (also in my tutorial! :-) See the topic: Using web Application Frameworks. This even covers accessing SQLite data... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/

Re: [Tutor] How to store output of Python program in XML

2019-07-13 Thread Alan Gauld via Tutor
at the "Building XML documents" section in the etree documentation. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos

Re: [Tutor] Output reason

2019-07-12 Thread Alan Gauld via Tutor
seful, usually it's not. The normal pattern to get round this is to use a None default and modify the function like so def fun(n,li = None): if not ni: ni = [] # create new list a = list(range(5)) li.append(a) return li # bad practice to mix logic and display... HTH -- A

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Alan Gauld via Tutor
ou might need to think carefully. In Sydney's scenario is sounds like the processes are different and explicitly halt to perform I/O so the cores issue should not be a problem. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gau

Re: [Tutor] RE Embedding Python in C

2019-07-09 Thread Alan Gauld via Tutor
ment the count after each import you will get the result you want? Although I'm guessing that relying on code to run via an import is probably a bad practice. You'd normally expect to import the module then call a function. But that's mostly guesswork, so I could well be wrong!

Re: [Tutor] Fw: [docs] Python Embedding PyImport_ImportModule

2019-07-08 Thread Alan Gauld via Tutor
ost them in their entirety. But most of all post the code! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldpho

Re: [Tutor] pointers or references to variables or sub-sets of variables query.

2019-07-07 Thread Alan Gauld via Tutor
s on small datasets are easier (or as easy) in native Python. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] pointers or references to variables or sub-sets of variables query.

2019-07-07 Thread Alan Gauld via Tutor
an RDBMS but hundreds of items is chickenfeed and an RDBMS would be overkill for such small numbers, if volume was the only criteria. Millions of items would certainly warrant such an approach but nowadays holding 10's of thousands of items in memory is entirely reasonable. -- Alan G Author of the Le

Re: [Tutor] Neutral Networks

2019-07-07 Thread Alan Gauld via Tutor
sample data too so we can see the structures. A little bit more detail on what exactly the output looks like and how you identified the problem would help. Finally, tell us the OS, Python version and any third party libraries you are using - SciPy, Rpy, etc. -- Alan G Author of the Learn to Progra

Re: [Tutor] pointers or references to variables or sub-sets of variables query.

2019-07-07 Thread Alan Gauld via Tutor
urprised to discover it has been modified elsewhere too. If that is a problem then you must explicitly create a copy. But the behaviour that you apparently want is the default. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my

Re: [Tutor] enumerate over Dictionaries

2019-07-06 Thread Alan Gauld via Tutor
don't have time to read through the rest. You really should refactor your code into functions. It will make it easier to modify, easier to debug, and much easier to read and discuss. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/au

Re: [Tutor] Regarding help in python algorithm

2019-07-05 Thread Alan Gauld via Tutor
o back and restructure your code into functions with reasonable names. Each one performing one clearly defined part of your solution. Then perhaps it will be easier to see where the issue(s) lie and certainly easier to describe them. -- Alan G Author of the Learn to Program web site http://ww

Re: [Tutor] enumerate over Dictionaries

2019-07-04 Thread Alan Gauld via Tutor
n dependent? Neither, it means the items in a list always have indexes starting at zero. By pure coincidence dictionaries in recent Python versions (since 3.6 or 3.7???) retain their insertion order. But that was not always the case, but the result w

Re: [Tutor] double nodes being enter into tree structure

2019-06-28 Thread Alan Gauld via Tutor
alue... So you need something like(untested!) for child in tree.children: if words[0] == child.name nextNode = child else: nextNode = tree.addNode(words[0],0) addNode(words[1:], nextNode) -- Alan G Author of the Learn to Pr

Re: [Tutor] Environment variables and Flask

2019-06-28 Thread Alan Gauld via Tutor
ig files are now preferred. But some things are a bit easier via en environment variable - especially where you spawn new sub-processes and don't want the sub-process to have to re-read the config file each time. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://w

Re: [Tutor] Python and DB

2019-06-27 Thread Alan Gauld via Tutor
library is probably more than adequate for your needs. PHP has modules for reading SQLite too. If you are familiar with using databases in any other language the Python DBAPI should be easy to pick up. If you don;t know SQL then you might like the database topic in my tutorial(see below) -- Alan

Re: [Tutor] Range command

2019-06-26 Thread Alan Gauld via Tutor
rienced programmers they are "A Good Thing" because they make Python more efficient and more consistent in the way it works. But for a beginner they just seem bizarre and unintuitive. For now, just accept them and eventually you will understand why they exist. -- Alan G Aut

Re: [Tutor] data structures general query

2019-06-26 Thread Alan Gauld via Tutor
uilt modules. It's a very rare problem that needs a traditional data structure in Python. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] data structures general query

2019-06-26 Thread Alan Gauld via Tutor
emory serves) try to force the tree to be balanced. Non binary trees need selector functions etc (often hash based). Real world use - database caches, network management heirarchies parsing structures. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon

Re: [Tutor] tree or link-list questions.

2019-06-26 Thread Alan Gauld via Tutor
e good news is that there are open source options available and Python modules to work with them. but it might be overkill for your project. But worth a quick Google and Wikipedia browse... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/a

Re: [Tutor] Training, Was: Basic Question about Visualization for enduser

2019-06-25 Thread Alan Gauld via Tutor
ey have to learn a complete new toolset. The principles will be similar but the practice very different. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphot

Re: [Tutor] Python Imported Code

2019-06-25 Thread Alan Gauld via Tutor
l(): >global myGlobal This tells changeGlobal() to use the module level variable above. ie nice2.myGlobal. >print("first value = ", nice.myGlobal) You didn't import nice into nice2 so this should give an error. >myGlobal="it worked&

Re: [Tutor] Basic Question about Visualization for enduser

2019-06-25 Thread Alan Gauld via Tutor
bly via SVG or similar technology. There have never been so many options for delivering content to end users! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.

Re: [Tutor] tree or link-list questions.

2019-06-25 Thread Alan Gauld via Tutor
}, {quick: [ {brown: [ {fox: []} ]}, ]}, ]}, {yellow: [ {flowers: []} ]} ]} Then you can access the appropriate path: myFox = data[the][quick][brown][fox] Just a thought. Since I don't really know how you intend to use this I'm not sure if that would work f

Re: [Tutor] tree or link-list questions.

2019-06-25 Thread Alan Gauld via Tutor
t the child to have the top level as its parent. The initial test of if self.name shouldn't be necessary since you assign name when you create the node. Without a name the node is pointless so you should check if name is None in the init method and throw an exception (ValueError?) if name i

Re: [Tutor] Basic Question about Visualization for enduser

2019-06-25 Thread Alan Gauld via Tutor
le search is probably your best bet. Python itself is just a programming language so somebody - possibly you! - has to write the apps. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://ww

Re: [Tutor] replacing a loop

2019-06-25 Thread Alan Gauld via Tutor
g else that might make a small difference is the pre-fetch of the locations. Why not: for location in self.eslocation.getDataSet(): You don't use the locDS value anywhere other than in the loop. Also the choice of method name is unfortunate in that you return both choices and keys but

Re: [Tutor] collections and mappings

2019-06-21 Thread Alan Gauld via Tutor
irs. Very occasionally it will be a class rather than a dictionary. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldpho

Re: [Tutor] Fwd: Re: Hii

2019-06-21 Thread Alan Gauld via Tutor
API or the PyWwin32 Python package may include functions that will do the job for you. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr

Re: [Tutor] collections and mappings

2019-06-21 Thread Alan Gauld via Tutor
_f = {'a':f('a'),'b':f('b'),'c':f('c')} List comprehensions and generator expressions are also commonly used to create mappings, especially the functional sort. I have no idea if the addressed any of your questions but if not please ask ag

[Tutor] Fwd: Re: Hii

2019-06-20 Thread Alan Gauld via Tutor
Forwarding to list. Please use Reply-All or Reply-List when responding to list emails. Forwarded Message Subject:Re: [Tutor] Hii Date: Thu, 20 Jun 2019 08:50:31 -0500 From: Antonio Arizpe To: Alan Gauld i am using python 3.7 On Thu, Jun 20, 2019 at 8:43

Re: [Tutor] word printing issue

2019-06-20 Thread Alan Gauld via Tutor
this without the > requirement of a module. Modules are there to be used... Here is one with itertools from the standard library that gets close: input = "hello Python team".split() result = [] for n in range(len(input): result += [item for item in it.combinations(input,n+1)] If you

Re: [Tutor] Hii

2019-06-20 Thread Alan Gauld via Tutor
t was struck in a real number. It is possible, but it will likely be OS specific so you need to tell us which OS you are using/targeting. Also any code that you've tried always helps along with any error messages. Also tell us about any 3rd party libraries you are using. -- Alan G Autho

Re: [Tutor] Unexpected result when running flask application.

2019-06-19 Thread Alan Gauld via Tutor
to Flask then I suspect you will need to ask on a Flask support page or list. It doesn't seem to be a Python language related issue at this point. And your layout.html template is virtually empty. I think you need to write some valid HTML somewhere. -- Alan G Author of the Learn to Program

Re: [Tutor] Installing Python on Server

2019-06-18 Thread Alan Gauld via Tutor
On 18/06/2019 14:28, Ben Wadsworth wrote: > Hi, > When installing Python on a windows server, will the server require a > restart? I've never tried so can't be sure. But it shouldn't. Python doesn't require any special access. But then again, it is Windows, so you

Re: [Tutor] How to Scrape Text from PDFs

2019-06-17 Thread Alan Gauld via Tutor
stions/34837707/how-to-extract-text-from-a-pdf-file There may even be more specific extraction tools if you look more closely... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flic

Re: [Tutor] Installing Python v3 on a laptop Windows 10

2019-06-15 Thread Alan Gauld via Tutor
mmend the ActiveState free version. It bundles several useful extra Windows tools and puts the docs in Windows help format for you. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.c

Re: [Tutor] deleting elements out of a list.

2019-06-15 Thread Alan Gauld via Tutor
description.pop[i] The usual way to remove things from a list is to create a new list using a filter newlist = filter(test_function, oldlist) or a list comprehension newlist = [item for item in oldlist if test_function(item)] Which brings us back to the beginning. Can you write

Re: [Tutor] Differences between while and for

2019-06-15 Thread Alan Gauld via Tutor
rticular construct that others will or should also support it. The variety of control structures offered is one of the defining features of any programming language. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on F

Re: [Tutor] os.is_file and os.is_dir missing from CPython 3.8.0b?

2019-06-14 Thread Alan Gauld via Tutor
2019, 22:28:20) ...these are new introductions in 3.8? If so, how do they differ from the os.path.isfile() and os.path.isdir() functions that already exist? Could you use those as alternatives? As to why the new functions aren't showing up, I've no idea, sorry. -- Alan G Author o

Re: [Tutor] Download audios & videos using web scraping from news website or facebook

2019-06-14 Thread Alan Gauld via Tutor
aven't shown us any code ewe can't really comment or make any suggestions. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___

Re: [Tutor] Installing Python

2019-06-10 Thread Alan Gauld via Tutor
perly". That gives us nothing to work on. What exactly is happening? Where did you download from? How did you try to install it? What actually happened? - Error messages? Or just a non-functioning icon or menu? Or nothing at all? The more specific the information you give us the better the c

Re: [Tutor] Python printing parentheses and quotes

2019-06-10 Thread Alan Gauld via Tutor
r 10.41.17.237 And in both cases the second print just prints out an empty string with no quotes. Are you sure that's not what you saw? > P.S. After I upgrade to Python3 this started working. In Python 3 print is a function so it needs the parentheses. Without them it will

Re: [Tutor] Pickles and Shelves Concept

2019-06-08 Thread Alan Gauld via Tutor
On 08/06/2019 01:02, Alan Gauld via Tutor wrote: > keys to your data and then restore it in any sequence, or > only restore some of it, you can. Apologies for the Yoda-speak at the end! A bit of editing that didn't quite work out as intended... -- Alan G Author of the Learn to Progr

Re: [Tutor] Pickles and Shelves Concept

2019-06-07 Thread Alan Gauld via Tutor
of your data later then its a bit of a nuisance. That's where shelve comes in. By acting like a persistent dictionary you can assign keys to your data and then restore it in any sequence, or only restore some of it, you can. Does that help? -- Alan G Author of the Learn to Program

Re: [Tutor] Fwd: Re: would someone please explain this concept to me

2019-06-06 Thread Alan Gauld via Tutor
On 06/06/2019 00:57, Alan Gauld via Tutor wrote: > But in the second example you actially change the object > that checklimit refers to. > > checklimit = 22 # immutable value assigned > feeds['bar'] = checklimit # both refer to same immutable value > base_var

Re: [Tutor] Fwd: Re: would someone please explain this concept to me

2019-06-05 Thread Alan Gauld via Tutor
being in a module, the issue is purely about references to objects and whether you modify the referenced object or its contents. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow m

Re: [Tutor] Fwd: Re: would someone please explain this concept to me

2019-06-05 Thread Alan Gauld via Tutor
k1] = Feed(v1,v2,v3) feeds[link2] = Feed() # use default values After all that's exactly what a class is - a template for an object. What you definitely don't want to do is what you have been doing and assigning the same single dictionary object to each link entry. -- Alan G Author o

Re: [Tutor] would someone please explain this concept to me

2019-06-04 Thread Alan Gauld via Tutor
d"]=r > > And it works. What works? What is different? I still don't know what you think should be happening, what is happening first time round, and what is now happening. > but why does it work? > > Why does that semi unlink all the variables? The semicolon should not &q

Re: [Tutor] Interactive editing of variables.

2019-06-02 Thread Alan Gauld via Tutor
all the "standard" forms of input - mice, pens, touch screens, keyboards, voice, etc -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] Interactive editing of variables.

2019-06-01 Thread Alan Gauld via Tutor
easily installable as a binary. If not try using the ActiveState distribution of python because it bundles all the windows tools in the installer. Personally I always use ActiveState pyton for my Windows boxes. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/

Re: [Tutor] Interactive editing of variables.

2019-06-01 Thread Alan Gauld via Tutor
y band wagon of in-accessible or non-inclusive design > products which is my passion. I can understand why folks get excited about it, especially if they (or friends/family) need that feature. But the cost (both in time and money) of doing so is considerable and if nobody is paying (or there is

Re: [Tutor] is this doable

2019-05-31 Thread Alan Gauld via Tutor
On 01/06/2019 00:13, Alan Gauld via Tutor wrote: > Is the language C/C++? If so you may know the OS API calls needed > and you could access those directly from Python using ctypes > That might make your job more familiar and easier. I meant to add a nod to Mark Hammond's win

Re: [Tutor] Interactive editing of variables.

2019-05-31 Thread Alan Gauld via Tutor
, somewhere has already done the work for you. But I don't know where... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos __

Re: [Tutor] is this doable

2019-05-31 Thread Alan Gauld via Tutor
ndows. I suspect there may be a dynamic registry entry you can read using the winreg registry module. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.f

Re: [Tutor] File extension against File content

2019-05-31 Thread Alan Gauld via Tutor
ate type. Combine with try/except to test a file... > This is because we can manually save the file in one extension and later > rename the file extension to some other. And indeed store the file with no extension at all. -- Alan G Author of the Learn to Program web site http:/

Re: [Tutor] Query about python recipies for practices

2019-05-27 Thread Alan Gauld via Tutor
the wonderful Python Challenge http://www.pythonchallenge.com/ Now up to 33 levels! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/a

[Tutor] Fwd: Re: Setting Command Line Arguments in IDLE

2019-05-26 Thread Alan Gauld via Tutor
Oops, Forgot to include the list! Forwarded Message Subject:Re: Setting Command Line Arguments in IDLE Date: Sun, 26 May 2019 09:03:36 +0100 From: Alan Gauld To: Richard Damon On 26/05/2019 02:55, Richard Damon wrote: > I am working on a python scr

[Tutor] Fwd: RE: regular expressions query

2019-05-24 Thread Alan Gauld via Tutor
Forwarding to the list, plase use reply-all or reply-list when responding to list mails. Alan G. Forwarded Message Subject:RE: [Tutor] regular expressions query Date: Fri, 24 May 2019 20:10:48 +1000 From: mhysnm1...@gmail.com To: 'Alan Gauld' Alla

Re: [Tutor] I'm having a small problem with my code

2019-05-24 Thread Alan Gauld via Tutor
Forwarding to the list. Always use Reply-All or Reply-List when responding to the list. Otherwise it only goes to the member who posted. Alan G. On 24/05/2019 10:20, David Lifschitz wrote: > Hi. > I'm learning the processes of python so I'm trying to figure out how > to sort

Re: [Tutor] regular expressions query

2019-05-24 Thread Alan Gauld via Tutor
s wondering if this > could be done? I'm not sure what you have in mind. For searching purposes you shouldn't need to modify the original string. (Of course Python strings are immutable so technically you can never modify a string, but in practice you can

Re: [Tutor] I'm having a small problem with my code

2019-05-23 Thread Alan Gauld via Tutor
et right in computing. It is one of those things that can seem right then one specific pattern will break it. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] Learning something new.

2019-05-23 Thread Alan Gauld via Tutor
ave written and any error messages in the message body, do not use attachments, especially not binary ones like screenshots, since the server will drop them. It also sometimes helps to know your Python version and your OS. Have fun, we look forward to your questions and we try not to yell at anyo

Re: [Tutor] A Python Newbie Requesting help with Lambdas, Filters, Maps, and Built-in Functions to solve problems for a List of Songs

2019-05-21 Thread Alan Gauld via Tutor
tand. Once you understand how the map/filter etc work you can decide where the named functions can be replaced by lambdas. As it stands your code is a fine demonstration of why lambdas are relatively rarely used! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.

Re: [Tutor] A Python Newbie Requesting help with Lambdas, Filters, and Maps

2019-05-21 Thread Alan Gauld via Tutor
)) > # return artist_titles Shouldn't this just use the first two functions? def artist_and_most_titles (songmix): return(artist_most_titles(songmix), most_titles(songmix)) The whole point of defining functions is that you can reuse them elsewhere... > # print (artist_

Re: [Tutor] Case Insensitive Globing

2019-05-20 Thread Alan Gauld via Tutor
On 20/05/2019 09:49, Alan Gauld via Tutor wrote: > On 19/05/2019 19:19, Alan Gauld via Tutor wrote: > ... >> So I always end up with two copies - the original file and the >> edited version. > I forgot I had moved all my photos onto my NAS box > and then mounted that in m

Re: [Tutor] Case Insensitive Globing

2019-05-20 Thread Alan Gauld via Tutor
On 19/05/2019 19:19, Alan Gauld via Tutor wrote: > Hmm, odd. My NTFS filesystems on Windows all appear to be case > sensitive. For example I have a photo editor that saves its files > with a jpg extension but the files from my camera all end in JPG. > So I always end up with two

Re: [Tutor] Case Insensitive Globing

2019-05-19 Thread Alan Gauld via Tutor
o cause that. More investigation required I think... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _

Re: [Tutor] Two Scripts, Same Commands, One Works, One Doesn't

2019-05-19 Thread Alan Gauld via Tutor
On 19/05/2019 04:58, DL Neil wrote: > last time I used the term "bomb", I'm guessing that "abend" wouldn't > pass muster either... Gosh, I haven't seen a reference to abend in 20 years. I'd almost managed to erase the memory... :-) -- Alan

  1   2   3   4   5   6   7   8   9   10   >