Re: [Tutor] Chunking list/array data?

2019-08-22 Thread Cameron Simpson
hunks lazily. Cheers, Cameron Simpson _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Chunking list/array data?

2019-08-22 Thread Peter Otten
; def chunks(items, n): ... return zip_longest(*[iter(items)]*n) ... >>> chunked = chunks("abcdefgh", 3) >>> next(chunked) ('a', 'b', 'c') >>> list(chunked) [('d', 'e', 'f'), ('g', 'h

[Tutor] Chunking list/array data?

2019-08-22 Thread Sarah Hembree
ily so as to keep memory drag at a minimum? --- We not only inherit the Earth from our Ancestors, we borrow it from our Children. Aspire to grace. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.

Re: [Tutor] Is nesting functions only for data hiding overkill?

2019-08-21 Thread Cameron Simpson
Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Is nesting functions only for data hiding overkill?

2019-08-21 Thread James Hartley
ient code. Is nesting considered Pythonic? Thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Is nesting functions only for data hiding overkill?

2019-08-21 Thread James Hartley
not ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-20 Thread C W
Thank you, Peter and Alan. Both very helpful. I was able to figure it out. Cheers! On Sat, Aug 17, 2019 at 5:45 AM Alan Gauld via Tutor wrote: > On 17/08/2019 00:46, C W wrote: > > The formatting seems messed up I'll try to straighten it out. > I hope I get it right! > >

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

2019-08-19 Thread nathan tech
on't worry about it, but you'll get there eventually :) > > > Micro-comment: a piece of code I'd hope to never see again: > > for x in range(len(map)): > map[x].append(default_grid_format) > > this lazily produces a counter from the size of an iterable obj

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

2019-08-19 Thread Mats Wichmann
and then uses the counter to index into said object; that's not needed since you can just iterate the object directly. Instead write it like this: for m in map: m.append(default_grid_format) Micro-comment: you can use anything (well, anything "hashable") as the key for a dict. So for: key=str(x)+":"+str(y) you can just do: key = (x, y) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-19 Thread Alan Gauld via Tutor
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 maillist - Tutor@python.org To unsubscribe or change subscription options: ht

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

2019-08-19 Thread Mark Lawrence
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-19 Thread Peter Otten
f get_default_format(): return "whatever" def show_cell(x, y): print(f"x = {x}, y = {y}, format = {grid_formats[x,y]!r}") grid_formats = defaultdict(get_default_format) grid_formats[42, 42] = "this cell is special" player_location = 3, 4 show_cell(*player

[Tutor] which of these is more efficient?

2019-08-19 Thread nathan tech
r(player_x)+":"+str(player_y) map[key]=default_grid_format Is this an efficient method compared to 1? Is it, code wise, sound logic? I guess I'm just looking for a second opinion from experienced peoples. thanks everyone. Nathan _____

Re: [Tutor] python question

2019-08-18 Thread Steven D'Aprano
On Sun, Aug 18, 2019 at 12:35:52PM +0800, Thejal Ramesh wrote: > Hi, i have a question regarding this question. I'm not quite sure what the > question is asking. Ask your tutor. We can help you with learning Python the programming language, not graph theory. https://en.wikiped

Re: [Tutor] python question

2019-08-18 Thread Alan Gauld via Tutor
normal for loop) 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.com/photos/alangauldphotos _______ Tutor maillist - Tutor@py

[Tutor] python question

2019-08-18 Thread Thejal Ramesh
ayton list,3) returns [0] . c) Calling popular(clayton list,0) returns [0,1,2,3,4]. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-17 Thread Alan Gauld via Tutor
g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-17 Thread Peter Otten
float, float], b: Tuple[float, float, float] ) --> float: ... Basically, use descriptive names for types rather than repeating their definition. _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] What is Tuple in the typing module?

2019-08-17 Thread C W
cience background. Thanks a lot! _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Search for Text in File

2019-08-15 Thread Alan Gauld via Tutor
tr' object is not > callable'. See my comments above. -- 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 maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Search for Text in File

2019-08-15 Thread Peter Otten
asics some two years ago I really meant it. If you can't be bothered have a look at preshrunk tools like grep, or find someone to write the code for you. > Thanks in advance. You're welcome. ___ Tutor maillist - Tutor@python.org To un

Re: [Tutor] Search for Text in File

2019-08-15 Thread David Rock
avid Rock da...@graniteweb.com _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Search for Text in File

2019-08-15 Thread Stephen P. Molnar
TypeError: 'str' object is not callable'. Assistance will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set http://www.Molecular-Modeling.net Multivariate and stochastic 614.312.7528 (c) Skype: smolnar1 ___

Re: [Tutor] Package which can extract data from pdf

2019-08-14 Thread William Ray Wing via Tutor
x27;s a Python interface that > sends your data off to a web service and you get answers back. > > There are probably dozens more... this seems to be an area with a lot of > reinvention going on. > > ___ > Tutor maillist - Tutor@p

Re: [Tutor] cgi module help (original poster)

2019-08-14 Thread rmlibre
On 2019-08-13 15:49, tutor-requ...@python.org wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with sub

Re: [Tutor] Package which can extract data from pdf

2019-08-14 Thread Mats Wichmann
your data off to a web service and you get answers back. There are probably dozens more... this seems to be an area with a lot of reinvention going on. _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Package which can extract data from pdf

2019-08-14 Thread Nupur Jha
Hi All, I have many pdf invoices with different formats. I want to extract the line items from these pdf files using python coding. I would request you all to guide me how can i achieve this. -- *Thanks & Regards,Nupur Jha* ___ Tutor mail

Re: [Tutor] class functions/staticmethod?

2019-08-13 Thread Cameron Simpson
gging into whatever weird consequences there might be to his slightly wrong code just brings confusion. Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] class functions/staticmethod?

2019-08-13 Thread Steven D'Aprano
. Your lesson gives us no clue why James' first method, "dimensions()", which he describes as a "class method", isn't a class method and doesn't actually work correctly, even though it appears to at first glance. -- Steven __

Re: [Tutor] class functions/staticmethod?

2019-08-13 Thread Cameron Simpson
x27;m getting an area function from a nicely named class. (Also, I wouldn't have to import the area function explicitly - it comes along with the class nicely.) So the static method is used to associate it with the class it supports, for use when the caller doesn't have an instance to

Re: [Tutor] cgi module help

2019-08-13 Thread Peter Otten
g: gzip, deflate, compress Accept: */* User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-170-generic Body: metadata=date&metadata=id 127.0.0.1 - - [13/Aug/2019 17:45:35] "POST / HTTP/1.1" 200 - It looks like the data doesn't even get through.

Re: [Tutor] HELP PLEASE

2019-08-13 Thread Alan Gauld via Tutor
mention my own tutorial linked in my .sig below :-) -- 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] HELP PLEASE

2019-08-13 Thread Sithembewena L. Dube
s with 0 and adds the values you give it, > but you're handing it "nums". > > Presently "nums" is a list of strings, thus the addition of the initial > 0 to a str in the exception message. > > If you move your misplaced "return to_ints(nums), to_ints(nums2)" > statement

Re: [Tutor] HELP PLEASE

2019-08-13 Thread Cameron Simpson
message. If you move your misplaced "return to_ints(nums), to_ints(nums2)" statement up into the get_numbers function you should be better off, because then it will return a list of numbers, not strings. Cheers, Cameron Simpson _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HELP PLEASE

2019-08-13 Thread David L Neil
or" means? Do you know the difference between an "int" and a "str[ing]"? Given that both sum() and len() return numbers, what do you think is the "str"? Might this refer back to the earlier suggestion that you need to 'see' the data being read?

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] cgi module help

2019-08-12 Thread rmlibre
"metadata" and .value == "date". But I need the actual values, not just the name of the element. Any idea how I can maintain this nested structure and retrieve the data within a nested dictionary in an elegant way? Constraints: For simplicity, I omitted the actual payload wh

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Marissa Russo
nums) > > def mean2(nums2): >for num in nums2: >_sum += nums2 > return _sum / len(nums2) > > def main(): >data = get_numbers() > >print("The mean of the first file is: ", mean) >print("The mean of the second file is: ", mean2) > main() > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[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] Union

2019-08-12 Thread Jim
[str, str] Can be either a filename or Base64 value. What is the usage of "Union". I don't recall seeing anything like it before. it's type annotation. Search here: https://docs.python.org/3/library/typing.html OK, thanks. Jim __

Re: [Tutor] Union

2019-08-12 Thread Mats Wichmann
ther a filename > or Base64 value. > > What is the usage of "Union". I don't recall seeing anything like it > before. it's type annotation. Search here: https://docs.python.org/3/library/typing.html _______ Tutor maillis

[Tutor] Union

2019-08-12 Thread Jim
of "Union". I don't recall seeing anything like it before. Thanks, Jim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Mats Wichmann
got comments on other stuff already: >>> def foo(): ... return "string from foo()" ... >>> print(foo) >>> print(foo()) string from foo() >>> ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Alan Gauld via Tutor
am 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 maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Sithembewena L. Dube
t; > def mean(nums): > for num in nums: > _sum += num > return _sum / len(nums) > > def mean2(nums2): > for num in nums2: > _sum += nums2 > return _sum / len(nums2) > > def main(): > data = get_numbers() > > print(&

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Joel Goldstick
ht put this here: m = mean(data[0]) m2 = mean2(data[1]) then print m and m2 > > print("The mean of the first file is: ", mean) > print("The mean of the second file is: ", mean2) > main() > So, first, show the complete error message here. > ___

[Tutor] HELP PLEASE

2019-08-12 Thread Marissa Russo
_sum += num return _sum / len(nums) def mean2(nums2): for num in nums2: _sum += nums2 return _sum / len(nums2) def main(): data = get_numbers() print("The mean of the first file is: ", mean) print("The mean of the second file is: "

Re: [Tutor] class functions/staticmethod?

2019-08-12 Thread Steven D'Aprano
return _dimensions If you are coming from a Java background, you may have been fooled by an unfortunate clash in terminology. A "static method" in Java is closer to a *classmethod* in Python, not a staticmethod. The main difference being that in Java, class variables (att

Re: [Tutor] class functions/staticmethod?

2019-08-12 Thread Steven D'Aprano
_dimensions = Dimensions(3, 4) @classmethod def dimensions(cls): print('id = {}'.format(id(cls._dimensions))) return cls._dimensions and now both Foo.dimensions() and Foo().dimensions() will work correctly, and as a bonus it ought to be a little faster. Part 3

Re: [Tutor] class functions/staticmethod?

2019-08-12 Thread Steven D'Aprano
t to receive "self" as the automatic first argument. That's pretty rare. For a very long time, the only known use for staticmethod was in the tests checking that the staticmethod code worked correctly. So that's what staticmethod does. It is occassionally useful, but no

Re: [Tutor] class functions/staticmethod?

2019-08-12 Thread Peter Otten
not really need static methods; they work like module-level functions. They are more of a means to organize your code; by writing class Foo: @staticmethod def bar(...): do stuff instead of def foo_bar(...): do stuff class Foo: pass you make the mental association between the class and the function a bit stronger. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] class functions/staticmethod?

2019-08-11 Thread James Hartley
print('id = {}'.format(id(_dimensions))) return _dimensions =8<-- The class method Foo.dimensions() is capable of accessing class members, but Foo.dimensions1() cannot. What does the @staticmethod decorator really add? Thanks! ______

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] instantiate and name a class from / with a string

2019-08-09 Thread ingo
get from data base setattr(root.channel, name, SSE(name)) is what I was looking for, time to read up on attributes, Thanks, Ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] instantiate and name a class from / with a string

2019-08-09 Thread Mats Wichmann
on you're not quite asking? Please be more precise. We're not trying to be argumentative; you have to help us know enough before we can help you. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Object creation query

2019-08-09 Thread bob gailer
On 8/9/2019 7:39 AM, Alan Gauld via Tutor wrote: On 09/08/2019 09:54, mhysnm1...@gmail.com wrote: updates and insertions. I have multiple tables with the same structure with differe I agree 100% with Peter and Alan's responses. -- Bob G

Re: [Tutor] instantiate and name a class from / with a string

2019-08-09 Thread bob gailer
asking for help in obtaining a value from a database? Or how to dynamically create instances assigned to root.channel attributes? Assuming the latter: name = # get from data base setattr(root.channel, name, SSE(name)) -- Bob Gailer ___ Tutor maillist

[Tutor] instantiate and name a class from / with a string

2019-08-09 Thread ingo
s') ... http://example.com/channel/weather/ will then become the emitter of the weather event stream. I'd like create the instances of SSE programmatically by pulling the string 'weather', 'energy' etc. from a database. Ingo ___

Re: [Tutor] Object creation query

2019-08-09 Thread Alan Gauld via Tutor
f 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 maillist - Tutor@python.org To unsubscribe or change subscription opti

Re: [Tutor] Object creation query

2019-08-09 Thread Peter Otten
from Accounts where name = account # find records for account records = select * from AccountEntries where accountId = wanted_accountId order by date desc That design would greatly simplify adding accounts 3 to, say, 30. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Object creation query

2019-08-09 Thread mhysnm1964
tter way in doing this rather than using a list of if tests? _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Error terminal

2019-08-07 Thread Mats Wichmann
eck what you're getting this way (this is a snip from my system, where the Python 3 came from homebrew, which is how I happen to install it): $ which python /usr/bin/python # system version, you don't want this one $ which python3 /usr/local/bin/python ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] flask_sqlalchemy query in relation to SQL relationships.

2019-08-07 Thread mhysnm1964
he category table which is a child of sub_categories which is a child of transactions. How would this be done in SQL? I hope this is the right place for this question. Sean ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Error terminal

2019-08-07 Thread Cameron Simpson
re precise than loose verbal descriptions alone). Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Error terminal

2019-08-07 Thread Richard Rizk
Hello I wanted to send you this email to ask if you would have someone that can solve the problem I'm having with python. I'm having issues with terminal on mac, is there someone that can help with this? Best regards, Richard ___ Tuto

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

2019-08-06 Thread Roel Schroeven
lection to graps the meaning. Every time again. If you use plural to indicate counts, what do you use for collections of items? -- "Honest criticism is hard to take, particularly from a relative, a friend, an acquaintance, or a stranger." -- Franklin P. Jones Roel Schroev

[Tutor] (no subject)

2019-08-06 Thread Stephen Tenbrink
___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Flask and flask_wtf issue -- I hpe someone can help.

2019-08-05 Thread mhysnm1964
he category ID. If I use validate or not on any fields, it doesn't produce anything in the flash. The page refreshes and leave the content in the field. The database isn't being updated with the new sub_category. All the database relationships are working when I manually insert the data i

Re: [Tutor] Inserting long URL's into comments & docstrings?

2019-08-05 Thread Ben Finney
dgement. -- \ “An expert is a man who has made all the mistakes which can be | `\ made in a very narrow field.” —Niels Bohr | _o__) | Ben Finney _______ Tutor mai

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
n data rather than behaviours is one of the most common errors by OOP newbies. It tends to result in programs that are procedural code disguised inside classes. And that usually results in the worst of both worlds. -- 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 maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-03 Thread David L Neil
NB am heading somewhat OT NBB Python3+ On 3/08/19 12:38 PM, Alan Gauld via Tutor wrote: On 03/08/2019 00:47, Malcolm Greene wrote: Anyways, I'm looking for help coming up for the proper name for a class that collects the following type of telemetry data Classes should never be name

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

2019-08-03 Thread Alan Gauld via Tutor
at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-03 Thread Richard Damon
lections of files, lines > bytes. (i.e. arrays or tuples...) > "___count" implies an integer. > If the latter, I'd use "n_files", "n_lines" ... (possibly without the > underscores if you find typing them a bother.) > Comments? I agree, plura

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

2019-08-03 Thread Alex Kleider
e "files", "lines", "bytes" implies collections of files, lines bytes. (i.e. arrays or tuples...) "___count" implies an integer. If the latter, I'd use "n_files", "n_lines" ... (possibly without the underscores if you find typing

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

2019-08-03 Thread Mats Wichmann
les", "lines", "bytes"... the plural form already tells you it's a counter. Opinions, we all have 'em :) _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-03 Thread Malcolm Greene
Thanks for everyone's feedback. Some interesting thoughts including Alan's "classes should never be named for their data but for their function" feedback. I'm going to have to noodle on that one. Good stuff! Malcolm _______

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

2019-08-02 Thread Alex Kleider
instance name rather than the class name. Sounds like a question for "an English Major". (Any Garrison Keillor fans out there?) _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-02 Thread Alan Gauld via Tutor
http://www.flickr.com/photos/alangauldphotos _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-02 Thread Cameron Simpson
ven your description. Unless they're snapshots/samples, in which case "Telemetric" ?-) Cheers, Cameron Simpson _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Name for this type of class?

2019-08-02 Thread Malcolm Greene
JobMetrics JobStats or JobStatistics JobTelemetry None of these feel right and of course everyone on our team has a different opinion. Does this question ring any bells? Thank you, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Cameron Simpson
r would not have a callable to work with; it would get the None that your @collect returns. This is the other argument for always returning a callable: to interoperate with other decorators, or of course anything else which works with a callable. Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread bob gailer
enter a command>') func = cmd_dict.get(cmd) -- Bob Gailer _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Mats Wichmann
between classes - I can accomplish some of that with decorators, but not all. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-02 Thread nathan tech
Hi Alan, thanks for that! I realise I provided quite a lot of unnecessary info, but I've been bitten a few times with the not providing enough so thought it best. Thanks again for confirming my thoughts, that's very helpful. Nate On 02/08/2019 01:27, Alan Gauld via Tutor wrote:

Re: [Tutor] Create Logging module

2019-08-02 Thread Sinardy Xing
'Current log level is : {}'.format(logger.level)) return orig_func(*args, **kwargs) return wrapper def timer(orig_func): import time #this wraps is to make sure we are returning orig_func instead of wrapper @wraps(orig_func) def wrapper(*args, **kwargs):

Re: [Tutor] Create Logging module

2019-08-02 Thread Sinardy Xing
On Fri, Aug 2, 2019 at 12:14 AM Alan Gauld via Tutor wrote: > On 01/08/2019 10:11, Sinardy Xing wrote: > > > start here--- > > > > import logging > > > > ..snip... > > > > from functools import wraps > > > > def logme(func_to_lo

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

2019-08-01 Thread Alan Gauld via Tutor
author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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

2019-08-01 Thread nathan tech
e. Nathan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python code

2019-08-01 Thread David Rock
ng wrong. >> Thank you so much! > > > What do you mean by "and change the directory before"? > > Python will start searching for 61.py in the *current* directory! > > -- > Regards =dn > ___ >

Re: [Tutor] Python code

2019-08-01 Thread David L Neil
the output is blank. Please let me know what I'm doing wrong. Thank you so much! What do you mean by "and change the directory before"? Python will start searching for 61.py in the *current* directory! -- Regards =dn _______ Tutor maillis

Re: [Tutor] Python code

2019-08-01 Thread Cameron Simpson
uot;py" command (I'm not on Windows here). So it may be that when you issue the command "python" it isn't running the Python interpreter but something else. Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Python code

2019-08-01 Thread Spencer Wannemacher
7;m doing wrong. Thank you so much! Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 _______ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Create Logging module

2019-08-01 Thread Sinardy Xing
aste > the text into your email. > > (P.S. please reply to the mailing list, not to me personally.) > > > -- > Steven > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://

Re: [Tutor] Create Logging module

2019-08-01 Thread Sinardy Xing
full traceback, starting with > the line "Traceback..." to the end. > > Don't take a screen shot or photo and send that, instead copy and paste > the text into your email. > > (P.S. please reply to the mailing list, not to me personally.) > > > -- > S

[Tutor] Python and Django dev available

2019-08-01 Thread Sithembewena L. Dube
nquiries only please. Kind regards, Sithembewena *Sent with Shift <https://tryshift.com/?utm_source=SentWithShift&utm_campaign=Sent%20with%20Shift%20Signature&utm_medium=Email%20Signature&utm_content=General%20Email%20Group>* _______

Re: [Tutor] Create Logging module

2019-08-01 Thread Peter Otten
is point. Try @logme def say_hello(name, age): print('Hello {}, I am {}'.format(name, age)) say_hello('Tonny', 8) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Create Logging module

2019-08-01 Thread Alan Gauld via Tutor
e returning func_to_log instead of > wrapper > @wraps(func_to_log) > def wrapper(*args, **kwargs): > logger.info('Ran with args: {}, and kwargs: {}'.format(args, > kwargs)) > return func_to_log(*args, **kwargs) > > return wrapper --

Re: [Tutor] Create Logging module

2019-08-01 Thread Steven D'Aprano
n shot or photo and send that, instead copy and paste the text into your email. (P.S. please reply to the mailing list, not to me personally.) -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https:/

[Tutor] Create Logging module

2019-08-01 Thread Sinardy Xing
ave error look like in the wrapper. Can someone point to me where is the issue or is this the correct way to create logging module? PS: above code with python 3.7.4 Thank you. regards, C ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

  1   2   3   4   5   6   7   8   9   10   >