RE: Issue in installing python

2021-10-16 Thread Abhi R
Hello Welcome to the Python Mailing List. Images will not get rendered on a Mailing List. Can you please copy- paste the error you're seeing as text? Regards [1]Abhiram Sent from [2]Mail for Windows From: [3]Kaviya Vadivel Sent: 17 October 2021 01:16 T

Re: some problems for an introductory python test

2021-08-16 Thread Abhiram R
site in Python! Happy to provide more tips wrt this if required. Regards Abhi R <http://abhiramr.com> On Tue, Aug 10, 2021 at 2:56 AM Hope Rouselle wrote: > I'm looking for questions to put on a test for students who never had > any experience with programming, but have l

Tracing in a Flask application

2021-08-04 Thread Javi D R
Hi I would like to do some tracing in a flask. I have been able to trace request in plain python requests using sys.settrace(), but this doesnt work with Flask. Moreover, what i want to trace is in a flask application, when an endpoint is called, what was the request, which parts of the code was

Re: argparse: delimiter for argparse list arguments

2021-08-03 Thread Sven R. Kunze
ction='append') At least from my point of view, I don't any way to separate both lists on this command call: cool-script.py thing1 thing2 stuff1 stuff2 Do I miss something here? Best Sven On 03.08.21 01:49, Dan Stromberg wrote: Isn't -- usually used to signal the end o

argparse: delimiter for argparse list arguments

2021-08-02 Thread Sven R. Kunze
Hi everyone, maybe, I am missing something here but is it possible to specify a delimiter for list arguments in argparse: https://docs.python.org/3/library/argparse.html Usually, '--' is used to separate two lists (cf. git). Cheers, Sven -- https://mail.python.org/mailman/listinfo/python-li

Re: pyttsx3 installation error

2021-07-02 Thread Abhiram R
etting imported, I'd suggest reading up on Virtual environments, how to create one, how to activate one and how to install packages in them. These might seem tedious if you're just starting off, but it's going to pay off. Happy programming! Abhiram R abhiramr.com On Sat, Jul 3,

Immutable view classes - inherit from dict or from Mapping?

2021-04-12 Thread Andreas R Maier
Hi, I have written some classes that represent immutable views on collections (see "immutable-views" package on Pypi). Currently, these view classes inherit from the abstract collection classes such as Mapping, Sequence, Set. However, they implement the read-only methods of dict, list and set,

Fw: See example

2020-12-04 Thread Arthur R. Ott
Sent from my BlackBerry - the most secure mobile device From: art...@gmail.com Sent: December 4, 2020 10:40 AM To: python-list@python.org Subject: See example Microsoft Windows [Version 10.0.19042.630] (c) 2020 Microsoft Corporation. All rights reserved. I am sure you can

Re: Winreg

2020-07-31 Thread R Pasco
s overly complicated and needlessly confusing. Thanks for your extensive info. Its too bad this isn't published in the python winreg/_winreg modules' info. Ray Pasco On Fri, Jul 31, 2020 at 12:43 AM R Pasco wrote: > My code was simply experimental and will be much refined in the future

Winreg

2020-07-30 Thread R Pasco
I can't find instructions for the proper way to reply to 'python list'. Is it simply a matter of keeping the message title identical to the original message and emailing again to python-list@python.org ? I'll reply both ways to test this. Yes, it's the 64/32-bit views that got me stuck. I think I

Winreg

2020-07-29 Thread R Pasco
I'm running python 3.8 on Windows 8.1 x64. Running the following code produces no errors but does not add a key, name or value. I had no problems doing this using _wirreg under python 2.7. Any insight will be helpful. Code: === import winreg hive = winreg.HKEY_LOCAL_MACHINE keypat

Re: Issues in downloading python

2020-07-17 Thread Abhiram R
H variable automatically and you should be able to access it from CMD after that. Regards Abhiram R <http://abhiramr.com> On Fri, Jul 17, 2020 at 10:28 PM Shanmika Sugavaneswaran < shanmisugu8...@outlook.com> wrote: > Though I install the setup , I couldn’t find Python in my system .

Format Logfile Name with logging.ini

2020-05-29 Thread connor . r . novak
In an effort to clean up my python logging practices when creating libraries, I have begun reading into "Advanced Logging" and converting my logging practices into logging configuration `.ini` files: [link](https://docs.python.org/3.4/howto/logging.html#configuring-logging) My question is: When

Phyton 32 or 64 bit?

2020-05-26 Thread R. A. Hoffman via Python-list
Good afternoon,   Please forgive what may be a stupid question. I’m an absolute beginner and downloaded Python 3.8 for 32bits. I’m running Windows 10 on 64bit machine.   Question 1 : is it OK to run Python (32 bits) on my machine ?   Question 2 : The download went fine. How do I go from her

Fwd: Problemas para ejecutar Python en windows 7

2020-04-01 Thread Honori R. Camacho
: http://rhonoric.blogspot.com/ <http://rhonoric.blogspot.com/>* -- Forwarded message - De: Honori R. Camacho Date: mié., 1 abr. 2020 a las 13:45 Subject: Problemas para ejecutar Python en windows 7 To: 1.- Necesitamos ayuda. No podemos ejecutar Python 3.5.4 en windows

Re: A small quiz

2020-01-24 Thread Mario R. Osorio
On Thursday, January 23, 2020 at 3:54:56 AM UTC-5, Z wrote: > what is PLR? PLR: Private Label Rights (https://en.wikipedia.org/wiki/Private_label_rights) -- https://mail.python.org/mailman/listinfo/python-list

Re: Congratulations to @Chris

2019-11-04 Thread Mario R. Osorio
On Thursday, October 24, 2019 at 4:29:59 PM UTC-4, Chris Angelico wrote: > On Fri, Oct 25, 2019 at 7:20 AM DL Neil via Python-list > wrote: > > > > Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner > > http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html > > > > .

Re: Do I need a parser?

2019-07-02 Thread Mario R. Osorio
On Saturday, June 29, 2019 at 8:40:06 AM UTC-4, josé mariano wrote: > Dear all, > > I'm sure that this subject has been addressed many times before on this > forum, but my poor knowledge of English and of computer jargon and concepts > results on not being able to find the answer i'm looking for

Re: help plz

2019-05-14 Thread Mario R. Osorio
On Monday, May 13, 2019 at 8:32:38 AM UTC-4, Tristan Cribaro wrote: > [image: image.png]so I have a project I have to work on that is due > tomorrow for a lot of points towards my grade. The issue here is I've been > trying to download Pillow and simple audio for my project and I keep > getting the

Re: Python program to phone?

2019-02-08 Thread Mario R. Osorio
I am not an expert in BeeWare (I've never used it) but I've read a good portion of their documentation and find it very interesting to say the least. I am looking forward using it in the very near future. On Fri, Feb 8, 2019 at 11:06 AM Mario R. Osorio wrote: > You will need

Re: Python program to phone?

2019-02-08 Thread Mario R. Osorio
You will need to have java. BeeWare's VOC tool, a transpiler from python to java, will do all the work for you so you don't even have know anything about java, except installing and setting it up for your environment Dtb/Gby === Mario R. Osorio B.A.S. of Information Technolo

Re: Python program to phone?

2019-02-05 Thread Mario R. Osorio
Hi there Steve. Did you check BeeWare? (https://pybee.org/) -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I get a python program to work on my phone?

2019-01-30 Thread Mario R. Osorio
You might want to check this project: https://pybee.org/ I've never used it but it shows promising. BTW, I'm a diabetic myself and I would be very thankful if you could share your application. I'm currently using 2 Android apps: StickBuddy offers a system to keep track of both where you pinch

Re: Recommendations for a novice user.

2019-01-08 Thread Mario R. Osorio
On Wednesday, January 2, 2019 at 1:05:44 PM UTC-5, Hüseyin Ertuğrul wrote: > I don't know the software language at all. What do you recommend to beginners > to learn Python. > What should be the working systematic? How much time should I spend every day > or how much time should I spend on a dail

Re: Kivy native GUI examples

2019-01-08 Thread Mario R. Osorio
On Monday, January 7, 2019 at 9:52:03 AM UTC-5, Dave wrote: > I need to select a Python GUI. It needs to cover all of the desktops > (Linux, Windows, Apple) and hopefully mobile (Android and Ios). I'm > looking at Kivy, but have yet to find an example app. that has a native > looking GUI (Wind

Re: help me in a program in python to implement Railway Reservation System using file handling technique.

2018-11-26 Thread Mario R. Osorio
On Saturday, November 24, 2018 at 1:44:21 AM UTC-5, Chris Angelico wrote: > On Sat, Nov 24, 2018 at 5:36 PM wrote: > > > > hello all, > > please hepl me in the above program. python to implement Railway > > Reservation System using file handling technique. > > > > System should perform below ope

[no subject]

2018-09-13 Thread V&amp;R Dota2
>From vigan Hi i wold like to join in this list because i want to start programing with python pls acept this -- https://mail.python.org/mailman/listinfo/python-list

Re: CURSES WINDOWS

2018-09-05 Thread Abhiram R
-- > > https://mail.python.org/mailman/listinfo/python-list > > -- Abhiram R abhiramr.github.io -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido van Rossum resigns as Python leader

2018-07-13 Thread Mario R. Osorio
On Friday, July 13, 2018 at 11:16:44 AM UTC-4, Bart wrote: > On 13/07/2018 13:33, Steven D'Aprano wrote: > > On Fri, 13 Jul 2018 11:37:41 +0100, Bart wrote: > > > >> (** Something so radical I've been using them elsewhere since forever.) > > > > And you just can't resist making it about you and y

python.exe - Not able to access

2018-04-08 Thread Murugesan R
Hi, I have installed Python in my system Windows - 7 SP1, While accessing Python terminal i am facing below error message, Please help me to resolve this issue. [cid:05c05c66-16b2-46f1-99db-423c04a69dc4]l Regards, Murugesan -- https://mail.python.org/mailman/listinfo/python-list

Re: for info

2018-02-01 Thread Mario R. Osorio
On Wednesday, January 31, 2018 at 10:55:59 AM UTC-5, M.Haroon Ali wrote: > from where we learn python for free of cost. i am begineer in python.plzz > help me And after you're done with the OFFICIAL tutorials; there thousands of excellent free tutorials online. Just do some research. If you're

Doubt in line_profiler documentation

2018-01-26 Thread Abhiram R
83.0, is the time taken 83.0*3.20802e-07 s? Or is there more to it? If my understanding is correct however, why would there be a need for this? What could be the cause of this - " It may be different on different systems "? Can someone help me out? Thanks Abhiram R ᐧ -- https://mail.python.org/mailman/listinfo/python-list

Python Learning

2017-12-15 Thread Varun R
Hi All, I'm new to programming, can anyone guide me, how to start learning python programming language,...plz suggest some books also. Thanks all -- https://mail.python.org/mailman/listinfo/python-list

Re: we want python software

2017-12-08 Thread Abhiram R
> > > 6. Click on the installer (if on Windows). > > > 7. Follow all the prompts. > > > 8. Enjoy. > > > > > > but this is too much for the tech student. > > > > You are assuming that the strangeness of the request is about 'tech&

Re: Python homework

2017-12-07 Thread Mario R. Osorio
On Tuesday, December 5, 2017 at 8:33:52 PM UTC-5, nick martinez wrote: > I have a question on my homework. My homework is to write a program in which > the computer simulates the rolling of a die 50 > times and then prints > (i). the most frequent side of the die > (ii). the average die value o

Re: we want python software

2017-12-05 Thread Abhiram R
> > > 6. Click on the installer (if on Windows). > > > 7. Follow all the prompts. > > > 8. Enjoy. > > > > > > but this is too much for the tech student. > > > > You are assuming that the strangeness of the request is about 'tech' > &

Re: Is there something like head() and str() of R in python?

2017-11-20 Thread Mario R. Osorio
On Sunday, November 19, 2017 at 2:05:12 PM UTC-5, Peng Yu wrote: > Hi, R has the functions head() and str() to show the brief content of > an object. Is there something similar in python for this purpose? > > For example, I want to inspect the content of the variable "train&quo

Re: Your feedback on our free Advanced Python tutorial

2017-07-21 Thread Mario R. Osorio
It would be nice if you made it more 'readable' the light gray foreground color of the text makes it very uncomfortable to read, at least to me. Take a look at: HOW THE WEB BECAME UNREADABLE https://www.wired.com/2016/10/how-the-web-became-unreadable/ -- https://mail.python.org/mailman/listinfo

RE: Error

2017-06-28 Thread Ken R. Lewis
Hello! I am running a script, and it comes up with an error. What can I do to make the error be corrected? I am thinking it is something with the data, possibly. I have only had Python for a few days, so maybe I copied some codes wrong. Also, does Python have a way to save files download

Re: Bigotry and hate speech on the python mailing list

2017-04-18 Thread Mario R. Osorio
On Monday, April 17, 2017 at 10:27:50 PM UTC-4, Rurpy wrote: > On 04/17/2017 04:38 AM, Ben Finney wrote: > > Rurpy via Python-list writes: > > > >> A couple weeks ago a frequent poster here (Steve D'Aprano > >> ) called another participant an "ugly > >> american" [*1]. > > > > He gave no explici

Re: PYTHON

2017-04-07 Thread Mario R. Osorio
On Thursday, April 6, 2017 at 8:43:48 AM UTC-4, alders...@gmail.com wrote: > Hello, how can I start programming? http://www.lmgtfy.com/?q=Hello%2C+how+can+I+start+programming%3F -- https://mail.python.org/mailman/listinfo/python-list

Traversal help

2017-04-02 Thread R. Bryan Smith
NES (cr) file into an array of objects''' temp_array = [] f = codecs.open(path, 'r', 'utf-8', ‘backslashreplace') for line in f: record = json.loads(line.strip('\n|\r')) temp_array.append(record) return temp_array I

Re: Spam user

2017-04-01 Thread Mario R. Osorio
I'm not in the business of starting an argument about best/worse newsreader, Ammammata, but could you please recommend a few? TIA -- https://mail.python.org/mailman/listinfo/python-list

Re: The hardest problem in computer science...

2017-01-06 Thread Mario R. Osorio
On Friday, January 6, 2017 at 8:45:41 PM UTC-5, Mario R. Osorio wrote: > On Friday, January 6, 2017 at 10:37:40 AM UTC-5, Ethan Furman wrote: > > On 01/06/2017 05:03 AM, Steve D'Aprano wrote: > > > > > what do we call the vertical and horizontal line elemen

Re: The hardest problem in computer science...

2017-01-06 Thread Mario R. Osorio
On Friday, January 6, 2017 at 10:37:40 AM UTC-5, Ethan Furman wrote: > On 01/06/2017 05:03 AM, Steve D'Aprano wrote: > > > what do we call the vertical and horizontal line elements? I want to make > > them configurable, which means the user has to be able to pass an argument > > that specifies the

Re: need some kind of "coherence index" for a group of strings

2016-11-03 Thread Mario R. Osorio
I don't know much about these topics but, wouldn't soundex do the job?? On Thursday, November 3, 2016 at 12:18:19 PM UTC-4, Fillmore wrote: > Hi there, apologies for the generic question. Here is my problem let's > say that I have a list of lists of strings. > > list1:#strings are sort of s

Re: Build desktop application using django

2016-10-17 Thread Mario R. Osorio
On Monday, October 17, 2016 at 1:00:14 PM UTC-4, John Gordon wrote: > In > ayuchitsalu...@gmail.com writes: > > > Hello I want to build a desktop application which retrieves data from > > server and stores data on server. I have basic experience of python and > > I dont know how to build that th

Re: Build desktop application using django

2016-10-16 Thread Mario R. Osorio
On Sunday, October 16, 2016 at 1:42:23 PM UTC-4, Ayush Saluja wrote: > Hello I want to build a desktop application which retrieves data from server > and stores data on server. I have basic experience of python and I dont know > how to build that thing. I agree with Martin's suspicion on you hav

Re: Can this be easily done in Python?

2016-09-28 Thread Mario R. Osorio
I'm not sure I understand your question, but I 'think' you area talking about executing dynamically chunks of code. If that is the case, there are a couple of ways to do it. These are some links that might interest you: http://stackoverflow.com/questions/3974554/python-how-to-generate-the-code-o

Re: [Python-ideas] Inconsistencies

2016-09-11 Thread Sven R. Kunze
On 10.09.2016 15:00, Chris Angelico wrote: Some things are absolute hard facts. There is no way in which 1 will ever be greater than 2, ergo "1 is less than 2" is strictly true, and not a matter of opinion. If you hear someone trying to claim otherwise, would you let him have his opinion, or woul

Re: datetime vs Arrow vs Pendulum vs Delorean vs udatetime

2016-08-06 Thread Mario R. Osorio
... so you decided to start the post already hijacked by yourself ... very clever!! On Friday, August 5, 2016 at 8:19:53 PM UTC-4, bream...@gmail.com wrote: > On Friday, August 5, 2016 at 7:15:37 PM UTC+1, DFS wrote: > > On 8/4/2016 6:41 PM, breamore...@gmail.com wrote: > > > Fascinating stuff h

Re: Fraud

2016-04-16 Thread Mario R. Osorio
Mel: Portuguese for honey Drosis: from Greek hidrōs; to sweat -- https://mail.python.org/mailman/listinfo/python-list

Re: Moderation and Usenet

2016-04-10 Thread Mario R. Osorio
On Sunday, April 10, 2016 at 2:01:00 PM UTC-4, Terry Reedy wrote: > On 4/10/2016 1:05 PM, Ethan Furman wrote: > > > If you see offensive posts from him on the Usenet side please do not > > respond. > > Just a reminder for those who, like me, prefer a newsgroup interface for > python-list: gmane

Re: Moderation and Usenet

2016-04-10 Thread Mario R. Osorio
hmmm...He made an extremely kind comment a couple of days ago. It called my attention because is the first one ever (coming from) ... Now I'm thinking he might have just been sarcastic. And BTW I myself have given a couple of sour responses every now and then. I guess we all have our bad days o

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Sven R. Kunze
On 06.04.2016 01:47, Chris Angelico wrote: Generally, I refactor code not because the files are getting "too large" (for whatever definition of that term you like), but because they're stretching the file's concept. Every file should have a purpose; every piece of code in that file should ideally

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Sven R. Kunze
On 06.04.2016 09:28, Michael Selik wrote: On Wed, Apr 6, 2016, 2:51 AM Steven D'Aprano wrote: On Wed, 6 Apr 2016 05:56 am, Michael Selik wrote: [Michael] When you made that suggestion earlier, I immediately guessed that you were using PyCharm. I agree that the decision to split into multip

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Sven R. Kunze
On 05.04.2016 20:40, Ethan Furman wrote: (utils.py does export a couple of functions, but they should be in the main module, or possibly made into a method of BidirectionalMapping.) Your package is currently under 500 lines. As it stands now, you could easily flatten it to a single module: b

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Sven R. Kunze
On 05.04.2016 19:59, Chris Angelico wrote: On Wed, Apr 6, 2016 at 3:38 AM, Sven R. Kunze wrote: Your package is currently under 500 lines. As it stands now, you could easily flatten it to a single module: bidict.py I don't recommend this. The line is blurry but 500 is definitely too

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Sven R. Kunze
On 05.04.2016 03:43, Steven D'Aprano wrote: The purpose of packages isn't enable Java-style "one class per file" coding, especially since *everything* in the package except the top level "bidict" module itself is private. bidict.compat and bidict.util aren't flagged as private, but they should be

Re: Best Practices for Internal Package Structure

2016-04-04 Thread Sven R. Kunze
Hi Josh, good question. On 04.04.2016 18:47, Josh B. wrote: My package, available at https://github.com/jab/bidict, is currently laid out like this: bidict/ ├── __init__.py ├── _bidict.py ├── _common.py ├── _frozen.py ├── _loose.py ├── _named.py ├── _ordered.py ├── compat.py ├── util.py I'd

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-31 Thread Sven R. Kunze
On 31.03.2016 18:30, Travis Griggs wrote: British: http://www.oxforddictionaries.com/definition/english/python American: http://www.dictionary.com/browse/python?s=t That does it. If I ever make some sort of open source module for pythun/pythawn I’ll be sure to call it either tuhmayto/tomawto

Re: Slice equivalent to dict.get

2016-03-31 Thread Sven R. Kunze
On 31.03.2016 17:07, Steven D'Aprano wrote: Sometimes people look for a method which is equivalent to dict.get, where they can set a default value for when the key isn't found: py> d = {1: 'a', 2: 'b'} py> d.get(999, '?') '?' The equivalent for sequences such as lists and tuples is a slice. I

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-30 Thread Sven R. Kunze
On 30.03.2016 12:21, BartC wrote: On 30/03/2016 11:07, Sven R. Kunze wrote: On 30.03.2016 01:29, Eric S. Johansson wrote: On 3/29/2016 6:05 AM, Sven R. Kunze wrote: Python = English As someone who writes English text and code using speech recognition, I can assure you that Python is not

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-30 Thread Sven R. Kunze
On 30.03.2016 12:14, Tim Golden wrote: Not that you quite meant this, but I'm always amused (and still a little startled) when I listen to talks recorded from, say, PyCon and hear people with American accents pronouncing Python with the stress on the slightly longer second syllable. (I don't kno

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-30 Thread Sven R. Kunze
On 30.03.2016 01:29, Eric S. Johansson wrote: On 3/29/2016 6:05 AM, Sven R. Kunze wrote: Python = English As someone who writes English text and code using speech recognition, I can assure you that Python is not English. :-) :D Interesting. Never thought of how Python sounds when spoken

Re: Threading is foobared?

2016-03-30 Thread Sven R. Kunze
On 30.03.2016 01:43, Steven D'Aprano wrote: On Tue, 29 Mar 2016 09:26 pm, Sven R. Kunze wrote: On 27.03.2016 05:01, Steven D'Aprano wrote: Am I the only one who has noticed that threading of posts here is severely broken? It's always been the case that there have been a few

Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-29 Thread Sven R. Kunze
On 29.03.2016 18:05, Peter Otten wrote: Reformatting it a bit String.Join( "\n", mylist.Where( foo => !String.IsNullOrEmpty(foo.description) ).Select( foo => foo.description)) this looks like a variant of Python's str.join( "\n", map(lambda foo: foo.des

Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-29 Thread Sven R. Kunze
On 29.03.2016 12:18, Sven R. Kunze wrote: On 29.03.2016 11:39, Peter Otten wrote: My question to those who know a bit of C#: what is the state-of-the-art equivalent to "\n".join(foo.description() for foo in mylist if foo.description() != "") U

Re: Exclude every nth element from list?

2016-03-29 Thread Sven R. Kunze
On 26.03.2016 18:06, Peter Otten wrote: beliavsky--- via Python-list wrote: I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? del x[::n] ;) Actually quite nice. -- https://mail.python.org/mailman/listinfo/python-list

Re: Threading is foobared?

2016-03-29 Thread Sven R. Kunze
On 27.03.2016 05:01, Steven D'Aprano wrote: Am I the only one who has noticed that threading of posts here is severely broken? It's always been the case that there have been a few posts here and there that break threading, but now it seems to be much more common. I agree. Didn't we both already

Re: newbie question

2016-03-29 Thread Sven R. Kunze
On 28.03.2016 17:34, ast wrote: "Matt Wheeler" a écrit dans le message de news:mailman.92.1458825746.2244.python-l...@python.org... On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: On 24.03.2016 11:57, Matt Wheeler wrote: >>>> import ast >>>> s = "

Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-29 Thread Sven R. Kunze
On 29.03.2016 11:39, Peter Otten wrote: My question to those who know a bit of C#: what is the state-of-the-art equivalent to "\n".join(foo.description() for foo in mylist if foo.description() != "") Using LINQ, I suppose: https://en.wikipedia.org/wiki/Language_Inte

Re: Learning Python (or Haskell) makes you a worse programmer

2016-03-29 Thread Sven R. Kunze
On 29.03.2016 06:13, Michael Torrie wrote: On 03/28/2016 06:44 PM, Steven D'Aprano wrote: http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/ I have the same problem as the writer. Working in Python makes me really dislike working in any other language

Re: Which are best, well-tested ways to create REST services, with Json, in Python?

2016-03-29 Thread Sven R. Kunze
Not heard of any but I can recommend django-restframework. We've got good experience with that. On 28.03.2016 23:06, David Shi via Python-list wrote: Has anyone done a recent reviews of creating REST services, in Python? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: Interpretation

2016-03-26 Thread Mario R. Osorio
On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting No pun intended, but I hope you are not typing your code like you typed your message. OTOH, python code is not supposed to be compi

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 14:22, Matt Wheeler wrote: On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. It has the added

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. -- https://mail.python.org/mailman/listinfo/python-list

Re: monkey patching __code__

2016-03-23 Thread Sven R. Kunze
On 23.03.2016 09:24, dieter wrote: But you have observed that you cannot do everything with a code substitution: a function call does not only depend on the code but also on other properties of the function object: e.g. the parameter processing. Yep, that's because Python is very flexible and p

how to cache invalidation

2016-03-22 Thread Sven R. Kunze
Hi everybody, I got another module up and running: xcache Background described here: http://srkunze.blogspot.com/2016/03/safe-cache-invalidation.html We needed a way to safely invalidate rlu_caches once a Web request has been finished. So, we came up with a solution using garbage collection

Re: monkey patching __code__

2016-03-22 Thread Sven R. Kunze
On 21.03.2016 21:42, Matt Wheeler wrote: On 20 March 2016 at 16:46, Sven R. Kunze wrote: On 19.03.2016 00:58, Matt Wheeler wrote: I know you have a working solution now with updating the code & defaults of the function, but what about just injecting your function into the modules that

Re: monkey patching __code__

2016-03-20 Thread Sven R. Kunze
On 19.03.2016 00:58, Matt Wheeler wrote: I know you have a working solution now with updating the code & defaults of the function, but what about just injecting your function into the modules that had already imported it after the monkeypatching? Seems perhaps cleaner, unless you'd end up having

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 16:02, Tim Chase wrote: On 2016-03-16 15:29, Sven R. Kunze wrote: I would re-use the "for-else" for this. Everything I thought I could make use of the "-else" clause, I was disappointed I couldn't. Hmm...this must be a mind-set thing. I use the "els

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 18:08, Random832 wrote: Yeah, well, you can *almost* get there with: try: thing = next(item for item in collection if good(item)) except StopIteration: thing = default But the for/else thing seems like a more natural way to do it. Plus, this is a toy example, if the body

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 14:47, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? That's it! :-) Thanks a lot. Just to understand this better: why is that not part of the code object but part of the function?

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 11:47, Peter Otten wrote: What would you expect? A keyword filling the missing functionality? Some Python magic, I haven't seen before. ;-) class Empty(Exception): pass ... def check_empty(items): ... items = iter(items) ... try: ... yield next(items) ...

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 20:10, Palpandi wrote: You can do like this. if not my_iterable: for x in my_iterable: Thanks for you help here, however as already pointed out, my_iterable is not necessarily a list but more likely an exhaustible iterator/generator. Best, Sven -- https://mail.pyth

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 13:57, Peter Otten wrote: I'd put that the other way round: syntactical support for every pattern would make for a rather unwieldy language. You have to choose carefully, and this requirement could easily be fulfilled by a function, first in your personal toolbox, then in a public

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 15:48, Ian Kelly wrote: Well I didn't design it, so I'm not really sure. But it could be argued that the defaults are intrinsic to the function declaration, not the code object, as not all code objects even have arguments. It also makes it straight-forward to create a new function t

Re: Replace weird error message?

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 19:53, Ben Finney wrote: Do you think some better error message should be used? Yes, I think that error message needs to be improved. Please file a bug report in Python's issue tracker https://bugs.python.org/>. For example a hint that "0" does work for the given argument. I sug

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 15:23, Ian Kelly wrote: On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? And as an afterthought, you'll likely need to replace the function's __globals__

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 17:37, Random832 wrote: On Wed, Mar 16, 2016, at 11:17, Sven R. Kunze wrote: I can imagine that. Could you describe the general use-case? From what I know, "else" is executed when you don't "break" the loop. When is this useful? for item in col

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 13:08, Steven D'Aprano wrote: Doing what? What is the code supposed to do? What's "empty" mean as a keyword? If you explain what your friends wants, then perhaps we can suggest something. Otherwise we're just guessing. I can think of at least two different meanings: * run the "emp

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 15:29, Sven R. Kunze wrote: On 16.03.2016 13:57, Peter Otten wrote: I'd put that the other way round: syntactical support for every pattern would make for a rather unwieldy language. You have to choose carefully, and this requirement could easily be fulfilled by a fun

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:58, alister wrote: no , i just typed it, while trying to hold a conversation with swmbo :-( apologies to the op if e could not see where i was intending to go with this. No problem, I perform quite well at guessing folk's intention. So, yes, I can extrapolate what you meant.

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:09, Tim Chase wrote: If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else: something_else() However, based on your follow-up that it's an exhaustible iterator rather than something you can len(), I'd u

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 17:20, Terry Reedy wrote: On 3/16/2016 11:17 AM, Sven R. Kunze wrote: On 16.03.2016 16:02, Tim Chase wrote: Does it annoy me when I have to work in other languages that lack Python's {for/while}/else functionality? You bet. I can imagine that. Could you describ

Re: empty clause of for loops

2016-03-18 Thread Sven R. Kunze
On 16.03.2016 17:56, Sven R. Kunze wrote: On 16.03.2016 17:37, Random832 wrote: On Wed, Mar 16, 2016, at 11:17, Sven R. Kunze wrote: I can imagine that. Could you describe the general use-case? From what I know, "else" is executed when you don't "break" the loop. W

Re: monkey patching __code__

2016-03-18 Thread Sven R. Kunze
On 18.03.2016 15:33, Sven R. Kunze wrote: On 18.03.2016 15:23, Ian Kelly wrote: On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? And as an afterthought, you'

Re: empty clause of for loops

2016-03-18 Thread Sven R. Kunze
On 17.03.2016 01:27, Steven D'Aprano wrote: That post describes the motivating use-case for the introduction of "if...else", and why break skips the "else" clause: for x in data: if meets_condition(x): break else: # raise error or do additional processing It might help to r

Re: Bash-like pipes in Python

2016-03-18 Thread Sven R. Kunze
On 16.03.2016 16:09, Joel Goldstick wrote: symbol '|' in python. Can you elaborate bitwise or -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >