Re: Problem slicing a list with the C API

2022-03-12 Thread Jen Kris via Python-list
Thanks for PySequence_InPlaceConcat, so when I need to extend I'll know what to use.  But my previous email was based on incorrect information from several SO posts that claimed only the extend method will work to add tuples to a list.  I found that's wrong -- even my own Python code uses the a

Re: for convenience

2022-03-21 Thread Avi Gross via Python-list
Chris, I think you understood the context but not the premise in a sense that wasin the way Paul was thinking. His premise is way off He seems to be thinking of something like a macro concept as iscommonly used in languages like C so: #define context bpy.context That could, in such languages, use

convenience

2022-03-22 Thread Avi Gross via Python-list
An earlier post talked about a method they used for "convenience" in a way they apparently did not understand and many of us educated them, hopefully. That made me wonder of teh impact on our code when we use various forms of convenience. Is it convenient for us as programmers, other potential re

Re: for convenience

2022-03-22 Thread Avi Gross via Python-list
I sent George a private reply as discussing other languages gets rapidly off-topic. I want to add a small addendum here about the technique he used and a Dave Neal and others are trying, a way to imagine things that is more compatible with how a language like Python works so it meets expectation.

Re: convenience

2022-03-22 Thread Avi Gross via Python-list
Greg, Yes, what I describe may not be common and some code goes to serious lengths precisely to make direct connections to internals on an object hard to access. But Python indeed allows and perhaps encourages you to use what you consider side effects but perhaps more. There are many dunder meth

Pyto Implementation - GROWING TREND

2022-03-24 Thread Steeve Kerou via Python-list
Hi, We develop Pyto - the first python class with an animated character that helps you learn the basics concepts of Python Language like you're playing video game - and we'd like it to be implemented.  Potential is limitless and can reach unlimited number of new users who will then use your soft

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Hopefully, adding to what Dave said, it helps to understand there often are choices and tradeoffs in everything and in particular to language design. And choices propagate so that making choice A and B may box you in so at some point choice Z is pretty much forced unless you start over and make o

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Original Message- From: Chris Angelico To: [email protected] Sent: Thu, Mar 24, 2022 1:37 pm Subject: Re: for convenience On Fri, 25 Mar 2022 at 04:15, Avi Gross via Python-list wrote: > Python made lots of choices early on and then tried to graft on ever more > features

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
xample, which I sometimes use in my programming, literally jumps out of the initial language. -Original Message- From: Chris Angelico To: [email protected] Sent: Thu, Mar 24, 2022 1:37 pm Subject: Re: for convenience On Fri, 25 Mar 2022 at 04:15, Avi Gross via Python-list wrote: &g

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Yes, Chris, you can do all kinds of useful things in Python and I can not make much of a case for requiring a pre-processor. The main reason would be to make code that interprets faster or produces a smaller file of Python commands. All I was saying was that there might be a scenario where a text

Re: How to detect an undefined method?

2022-03-27 Thread Kirill Ratkin via Python-list
Hi You can get all methods of your object and check the method you want to call is there or not. |methods = [method for method in dir() if callable(getattr(, method))] if 'method_you_need' in methods: . // BR | 27.03.2022 12:24, Manfred Lotz пишет: Let's say I have a Python app and have u

Re: How to detect an undefined method?

2022-03-27 Thread Kirill Ratkin via Python-list
I just started to think from your example with method 'err' of logger object. In this particular case you can check method 'err' exists or not before call this. But if you mean general case ... . If for example I use some library which uses another library and someone just 'typo' there ...

Re: How to detect an undefined method?

2022-03-27 Thread Avi Gross via Python-list
t has that method before trying to invoke it, or you can handle exceptions generated if it doesn't. -Original Message- From: Kirill Ratkin via Python-list To: [email protected] Sent: Sun, Mar 27, 2022 2:29 pm Subject: Re: How to detect an undefined method? I just started to

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-28 Thread Cecil Westerhof via Python-list
"Loris Bennett" writes: > Marco Sulla writes: > >> On Fri, 11 Mar 2022 at 19:10, Michael Torrie wrote: >>> Both Debian stable and Ubuntu LTS state they have a five year support >>> life cycle. >> >> Yes, but it seems that official security support in Debian ends after >> three years: >> >> "Deb

Re: calling a function asynchronously

2022-03-30 Thread Kirill Ratkin via Python-list
Hi, You can use asyncio.create_task and gather results. See docs - https://docs.python.org/3/library/asyncio-task.html But think twice what you want to do in async task. Do you use synchronous requests to database? If yes it will blocks eventloop... If you use Django it makes sense to use someth

Re: calling a function asynchronously

2022-03-30 Thread Kirill Ratkin via Python-list
Hi again, I changed a bit your example and it works as you expected I hope. import asyncio async def long():     for i in range(100):     await asyncio.sleep(10)     print("long is done") loop = asyncio.get_event_loop() task = loop.create_task(long()) print('after asyncio.run') loop

Re: calling a function asynchronously

2022-03-30 Thread Kirill Ratkin via Python-list
Hi 30.03.2022 21:44, Larry Martell пишет: On Wed, Mar 30, 2022 at 2:40 PM Kirill Ratkin via Python-list wrote: Hi again, I changed a bit your example and it works as you expected I hope. import asyncio async def long(): for i in range(100): await asyncio.sleep(10

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-31 Thread Cecil Westerhof via Python-list
"Peter J. Holzer" writes: > On 2022-03-28 15:35:07 +0200, Cecil Westerhof via Python-list wrote: >> "Loris Bennett" writes: >> > Ubuntu is presumably relying on the Debian security team as well as >> > other volunteers and at least one compan

Temporally disabling buffering

2022-03-31 Thread Cecil Westerhof via Python-list
In Python when the output of a script is going to a pipe stdout is buffered. When sending output to tee that is very inconvenient. We can set PYTHONUNBUFFERED, but then stdout is always unbuffered. On Linux we can do: PYTHONUNBUFFERED=T script.py | tee script.log Now the output is only unbuf

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-31 Thread Cecil Westerhof via Python-list
"Peter J. Holzer" writes: > On 2022-03-30 08:48:36 +0200, Marco Sulla wrote: >> On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote: >> > They are are about a year apart, so they will usually contain different >> > versions of most packages right from the start. So the Ubuntu and Debian >> > sec

Re: dict.get_deep()

2022-04-03 Thread Kirill Ratkin via Python-list
Hi Marco. Recently I met same issue. A service I intergated with was documented badly and sent ... unpredictable jsons. And pattern matching helped me in first solution. (later I switched to Pydantic models) For your example I'd make match rule for key path you need. For example: data = {

Re: dict.get_deep()

2022-04-03 Thread Kirill Ratkin via Python-list
To my previous post. It seems 'case if' should help with types: case {"users": [{"address": {"street": street}}]} if isinstance(street, str): :) // BR 02.04.2022 23:44, Marco Sulla пишет: A proposal. Very often dict are used as a deeply nested carrier of data, usually decoded from JSON.

Re: Sharing part of a function

2022-04-03 Thread Cecil Westerhof via Python-list
Betty Hollinshead writes: > "Memoising" is the answer -- see "Python Algorithms" by Magnus Lie Hetland. > In the mean time, here a simplified version of "memoising" using a dict. > This version handles pretty large fibonacci numbers! > > # fibonacci sequence > # memoised - but using a simple dict

Re: dict.get_deep()

2022-04-03 Thread Avi Gross via Python-list
I may have misunderstood something. The original post in this subject sounded to ME likethey had nested dictionaries and wanted to be ableto ask a method in the first dictionary totake an unspecified number of arguments thatwould be successive keys and return the results. I mean if A was a dicti

Re: dict.get_deep()

2022-04-04 Thread Kirill Ratkin via Python-list
solutions on pypi (https://pypi.org/project/dpath/, https://pypi.org/project/path-dict/). But maybe (and maybe I miss again) we talk about language embedded solution like operator ? or ??. For example deep dict extraction could look like: street = data["users"]?[0]?["address&quo

Re: dict.get_deep()

2022-04-04 Thread Avi Gross via Python-list
ns offered. -Original Message- From: Kirill Ratkin via Python-list To: [email protected] Sent: Mon, Apr 4, 2022 3:40 am Subject: Re: dict.get_deep() Hello, Yes, I misunderstood as well because started to think about pattern matching which is good but this is not subject the question

Re: Sharing part of a function

2022-04-07 Thread Cecil Westerhof via Python-list
Cecil Westerhof writes: > To show why it is often easy, but wrong to use recursive functions I > wrote the following two Fibonacci functions: > def fib_ite(n): > if not type(n) is int: > raise TypeError(f'Need an integer ({n})') > if n < 0: > raise Valu

Making a Python program into an executable file

2022-04-11 Thread Brian Wagstaff via Python-list
Dear Python team, I am trying to find out how to make my Python programs into executable files (.exe, I presume) using Pyinstaller. I searched on line for how to do this (the document I came across is headed Data to Fish), and it seemed that Step 1 was to download the most recent version of Pyth

Functionality like local static in C

2022-04-14 Thread Cecil Westerhof via Python-list
In C when you declare a variable static in a function, the variable retains its value between function calls. The first time the function is called it has the default value (0 for an int). But when the function changes the value in a call (for example to 43), the next time the function is called th

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-14 Thread Jon Ribbens via Python-list
On 2022-04-14, Paul Bryan wrote: > I think because minutes and hours can easily be composed by multiplying > seconds. days is separate because you cannot compose days from seconds; > leap seconds are applied to days at various times, due to > irregularities in the Earth's rotation. That's an argu

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-14 Thread Jon Ribbens via Python-list
On 2022-04-14, MRAB wrote: > On 2022-04-14 16:22, Jon Ribbens via Python-list wrote: >> On 2022-04-14, Paul Bryan wrote: >>> I think because minutes and hours can easily be composed by multiplying >>> seconds. days is separate because you cannot compose days from se

Re: Functionality like local static in C

2022-04-15 Thread Cecil Westerhof via Python-list
Thanks for the multiple answers. I was pleasantly surprised. I have something to think about. :-D In principle I selected a solution for the problem for which I asked it, but I first have to finish some other stuff. I hope to find time to implement it next week. Everyone a good weekend and Easter

Re: code confusion

2022-04-15 Thread Avi Gross via Python-list
As usual, without very clear and precise instructions and parameters, the answers may not quite fit. It looks like you are asked two and only two questions. The first is asking how many numbers you want.  Before continuing, you need to make sure that is a valid number as many answer will throw a

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Jon Ribbens via Python-list
On 2022-04-16, Peter J. Holzer wrote: > On 2022-04-14 15:22:29 -, Jon Ribbens via Python-list wrote: >> On 2022-04-14, Paul Bryan wrote: >> > I think because minutes and hours can easily be composed by multiplying >> > seconds. days is separate because you canno

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Jon Ribbens via Python-list
On 2022-04-16, Jon Ribbens wrote: > On 2022-04-16, Peter J. Holzer wrote: >> Python missed the switch to DST here, the timezone is wrong. > > Because you didn't let it use any timezone information. You need to > either use the third-party 'pytz' module, or in Python 3.9 or above, > the built-in '

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Jon Ribbens via Python-list
On 2022-04-16, Peter J. Holzer wrote: > On 2022-04-16 13:47:32 -, Jon Ribbens via Python-list wrote: >> That's impossible unless you redefine 'timedelta' from being, as it is >> now, a fixed-length period of time, to instead being the difference >> bet

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Jon Ribbens via Python-list
On 2022-04-16, Peter J. Holzer wrote: > On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote: >> On 2022-04-16, Jon Ribbens wrote: >> > On 2022-04-16, Peter J. Holzer wrote: >> >> Python missed the switch to DST here, the timezone is wrong. >> >

Re: How do I make a video animation with transparent background?

2016-08-09 Thread Dale Marvin via Python-list
On 8/9/16 6:50 PM, Lawrence D’Oliveiro wrote: On Wednesday, August 10, 2016 at 12:44:30 AM UTC+12, Martin Schöön wrote: What I have failed to achieve is a graph with a transparent background. While it is possible to render image frames with alpha transparency channels, as far as I know none

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Larry Hudson via Python-list
On 08/17/2016 04:24 AM, Jussi Piitulainen wrote: ... http://www-formal.stanford.edu/jmc/recursive/node2.html (the paper famously titled "Part I" without any Part II, unless I mistake much.) Totally OT here, but... This reminds me of a old record I have with the (deliberately tongue-in-cheek)

Re: Python 3: Launch multiple commands(subprocesses) in parallel (but upto 4 any time at same time) AND store each of their outputs into a variable

2016-08-23 Thread Dale Marvin via Python-list
On 8/23/16 8:15 PM, [email protected] wrote: > I am trying to: > > 1) Use Python 3+ (specifically 3.4 if it matters) > 2) Launch N commands in background (e.g., like subprocess.call would for individual commands) > 3) But only limit P commands to run at same time > 4) Wait until all N comman

Re: Multimeter USB output

2016-08-29 Thread Larry Hudson via Python-list
On 08/29/2016 01:54 AM, Joe wrote: [snip...] Interesting, but... The last time I did something with c, it was with BDS-C under CM/M. Somebody remenbering this no-fp compiler from the dark age before PC und Linux? I remember it well. It's what I used to initially learn C. I'm a completely sel

Re: Multimeter USB output

2016-08-30 Thread Larry Hudson via Python-list
On 08/30/2016 04:01 AM, D'Arcy J.M. Cain wrote: On Mon, 29 Aug 2016 21:21:05 -0700 Larry Hudson via Python-list wrote: I remember it well. It's what I used to initially learn C. I'm a completely self-taught, hobby programmer. Been around since the MITS Altair. How many reme

Re: [OT] Altair

2016-08-30 Thread Larry Hudson via Python-list
On 08/30/2016 11:51 AM, Joe wrote: Am 30.08.2016 um 17:52 schrieb D'Arcy J.M. Cain: On Tue, 30 Aug 2016 15:56:07 +0200 Joe wrote: Am 30.08.2016 um 13:01 schrieb D'Arcy J.M. Cain: On Mon, 29 Aug 2016 21:21:05 -0700 Larry Hudson via Python-list wrote: I remember it well. It's

Re: Multimeter USB output

2016-08-30 Thread Larry Hudson via Python-list
On 08/29/2016 09:24 PM, Paul Rubin wrote: Larry Hudson writes: with BDS-C under CP/M. Somebody remenbering this no-fp compiler from the dark age before PC und Linux? I remember it well. It's what I used to initially learn C. Source code is online here: http://www.bdsoft.com/resources/bdsc.

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Larry Hudson via Python-list
On 09/04/2016 09:00 AM, Veek. M wrote: Steve D'Aprano wrote: On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: Regarding the name (From field), my name *is* Veek.M […] Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no l

Re: How to split value where is comma ?

2016-09-08 Thread Larry Hudson via Python-list
On 09/08/2016 07:57 AM, John Gordon wrote: In Joaquin Alzola writes: Use the split a.split(",") for x in a: print(x) This won't work. split() returns a list of split elements but the original string remains unchanged. You want something like this instead: newlist = a.split(",")

Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-14 Thread Dale Marvin via Python-list
On 9/14/16 12:20 AM, Steven D'Aprano wrote: On Wednesday 14 September 2016 16:54, Rustom Mody wrote: everything we know will be negated in 5-50-500 years I'm pretty sure that in 5, 50, 500 or even 5000 years, the sun will still rise in the east, water will be wet, fire will burn, dogs will ha

Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-14 Thread Dale Marvin via Python-list
On 9/14/16 5:40 PM, Steve D'Aprano wrote: If you're going to criticise Asimov, don't criticise him for wrongly thinking that people in the Middle Ages believed in a flat earth. There's no evidence of that in his essay. I didn't mean to criticize Asimov, but the History Professors, one in par

Re: Data Types

2016-09-22 Thread Larry Hudson via Python-list
On 09/20/2016 09:03 PM, Cai Gengyang wrote: [snip...] So for example for "bool" , it only applies to True/False and nothing else? (2 data types), i.e. : Not exactly... bool is the data type (or class), True and False are the only two _values_ (not types). type(True) type(False) [

Re: strings and ints consistency - isinstance

2016-09-22 Thread Larry Hudson via Python-list
On 09/22/2016 06:40 AM, Sayth Renshaw wrote: [snip...] True it failed, just actually happy to get it to fail or pass successfully on int input. Just felt it was a clearer and more consistent approach to verifying input, then most of the varied and rather inconsistent approaches I have seen in

RE: [E] ANN: asciimatics v1.7.0

2016-09-26 Thread Scherer, Bill via Python-list
Looks cool. Why does it want to install pypiwin32 on my 64bit Linux box? I installed all the requirements separately, but it still wants to install pypiwin32. (pypiwin32 appears to not support Python3) # pip3.5 install asciimatics Collecting asciimatics Using cached asciimatics-1.7.0-py2.py3

Re: Nested for loops and print statements

2016-09-26 Thread Larry Hudson via Python-list
On 09/26/2016 08:25 AM, Cai Gengyang wrote: I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum It is NOT weird. Python is being consistent, YOU are not. These examples are NOT "exactly the same code

Re: Nested for loops and print statements

2016-09-27 Thread Larry Hudson via Python-list
On 09/26/2016 01:57 PM, Cai Gengyang wrote: Ok it works now: for row in range(10): for column in range(10): print("*",end="") but how is it different from --- for row in range

Re: Nested for loops and print statements

2016-09-28 Thread Larry Hudson via Python-list
On 09/27/2016 09:20 PM, Steven D'Aprano wrote: On Wednesday 28 September 2016 12:48, Larry Hudson wrote: As they came through in the newsgroup, BOTH run correctly, because both versions had leading spaces only. (I did a careful copy/paste to check this.) Copying and pasting from the news clie

ANN: distlib 0.2.4 released on PyPI

2016-09-30 Thread Vinay Sajip via Python-list
I've just released version 0.2.4 of distlib on PyPI [1]. For newcomers, distlib is a library of packaging functionality which is intended to be usable as the basis for third-party packaging tools. The main changes in this release are as follows: * Updated to not fail during import if SSL is not a

I can't run python on my computer

2016-10-05 Thread Camille Benoit via Python-list
Hi,it has been about a week since the last time I was able to use Python. Most of the time, the interpreter doesn't show up and when it does and I am trying to run a program it displayed the following message: "IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or per

Re: Function to take the minimum of 3 numbers

2016-10-09 Thread Larry Hudson via Python-list
On 10/09/2016 05:01 AM, Cai Gengyang wrote: def min3(a, b, c): min3 = a if b < min3: min3 = b if c < min3: min3 = c if b < c: min3 = b return min3 print(min3(4, 7, 5)) 4 This is NOT a recommendation here, just a different way of looking a

Re: Need help with coding a function in Python

2016-10-31 Thread Larry Hudson via Python-list
On 10/31/2016 03:09 PM, [email protected] wrote: http://imgur.com/a/rfGhK#iVLQKSW How do I code a function that returns a list of the first n elements of the sequence defined in the link? I have no idea! So far this is my best shot at it (the problem with it is that the

What is currently the recommended way to work with a distutils-based setup.py that requires compilation?

2016-11-06 Thread Ivan Pozdeev via Python-list
https://wiki.python.org/moin/WindowsCompilers has now completely replaced instructions for `distutils`-based packages (starting with `from distutils.core import setup`) with ones for `setuptools`-based ones (starting with `from setuptools import setup`). However, if I have a `distutils`-based

Re: Confused with installing per-user in Windows

2016-11-06 Thread Ivan Pozdeev via Python-list
On 07.11.2016 4:11, ddbug wrote: Dear experts, I need to install some scripts for current user (to skip sudo, UAC popups and whatever). So I make a sdist and use python -m pip install --user This should work for either Python 2 or 3. On Linux, pip installs the scripts into ~/.local/bin

Re: Windows: subprocess won't run different Python interpreter

2016-11-11 Thread Gisle Vanem via Python-list
Thorsten Kampe wrote: > My goal is to verify that other shells/interpreters on Windows work > the same way as Python when running an application or creating a sub- > process. Cmd does not. What's else there? I have Bash here but that's > a Cygwin executable. And Cygwin Python does not work like

Re: A question about sprite rendering in game development

2016-11-16 Thread Larry Hudson via Python-list
On 11/16/2016 12:16 AM, shadecelebi wrote: thanx a lot you guys. I'm slightly familiar with pygame from before so I'll make sure to utilize it. and no I don't have any of the characters yet as I've yet to start. I just wanted to know if I should keep learning python or if it would be trivial t

modify screen pop up

2016-11-17 Thread John Zayatz via Python-list
when running pycharm the modify setup window keep coming on the screen. I have uninstalled and reinstalled python and pycharm multiple times. Do you have a solution? Thank You" -- https://mail.python.org/mailman/listinfo/python-list

key and ..

2016-11-17 Thread Val Krem via Python-list
Hi all, Sorry for asking such a basic question butI am trying to merge two files(file1 and file2) and do some stuff. Merge the two files by the first column(key). Here is the description of files and what I would like to do. file1 key c1 c2 1 759 939 2 345 154571 3 251 350711 4 3749

Re: need help to get my python image to move around using tkinter

2016-11-18 Thread Thomas Grops via Python-list
thankyou so much, that is the exact help I required to put me in the right direction :D -- https://mail.python.org/mailman/listinfo/python-list

Re: Can somebody tell me what's wrong wrong with my code? I don't understand

2016-11-23 Thread Larry Hudson via Python-list
On 11/21/2016 07:10 PM, [email protected] wrote: Hi! This is my first post! I'm having trouble understanding my code. I get "SyntaxError:invalid syntax" on line 49. I'm trying to code a simple text-based rpg on repl.it. Thank you for reading. print("Welcome to Gladiator Game! Choose your ch

Re: How to you convert list of tuples to string

2016-11-23 Thread Larry Hudson via Python-list
On 11/22/2016 08:51 AM, Michiel Overtoom wrote: Hi Ganesh, Any better suggestion to improve this piece of code and make it look more pythonic? import random # A list of tuples. Note that the L behind a number means that the number is a 'long'. data = [(1, 1, 373891072L, 8192), (1, 3, 390

Random number help

2016-11-23 Thread Thomas Grops via Python-list
I need a way of generating a random number but there is a catch: I don't want to include certain numbers, is this possible? random.randint(1,100) works as it will randomly pick numbers between 1 and 100 but say i don't want 48 to come out is there a way of doing this. It needs to be an integer

Re: Random number help

2016-11-23 Thread Thomas Grops via Python-list
On Wednesday, 23 November 2016 19:30:04 UTC, Thomas Nyberg wrote: > On 11/23/2016 02:17 PM, Thomas Grops via Python-list wrote: > > I need a way of generating a random number but there is a catch: > > > > I don't want to include certain numbers, is this possible? &g

Re: Random number help

2016-11-23 Thread Thomas Grops via Python-list
On Wednesday, 23 November 2016 19:30:21 UTC, Chris Kaynor wrote: > On Wed, Nov 23, 2016 at 11:17 AM, Thomas Grops via Python-list > wrote: > > I need a way of generating a random number but there is a catch: > > > > I don't want to include cert

Re: Random number help

2016-11-23 Thread Thomas Grops via Python-list
Thankyou for all your help I have managed to pick a way that works from your suggestions :D -- https://mail.python.org/mailman/listinfo/python-list

Re: How to you convert list of tuples to string

2016-11-23 Thread Larry Hudson via Python-list
On 11/23/2016 03:09 AM, Ned Batchelder wrote: [snip...] Or using the new string formatting syntax: msg = '{},{},{}:{}'.format(*item) The *item in the format() unpacks the tuple. "new" == "Introduced in 2.6, available since 2008" :) --Ned. Of course. I probably should have said "newer" o

Re: Random number help

2016-11-23 Thread Larry Hudson via Python-list
On 11/23/2016 11:17 AM, Thomas Grops wrote: I need a way of generating a random number but there is a catch: I don't want to include certain numbers, is this possible? random.randint(1,100) works as it will randomly pick numbers between 1 and 100 but say i don't want 48 to come out is there a

Help with two issues, buttons and second class object

2016-11-24 Thread Thomas Grops via Python-list
Hi I have created some code, which moves a rectangle around and when it hits the edge it picks a random new direction. It does this by the count function within my class. I am wanting to create a button to randomly change count but I my class seems to be getting errors. I also wanted to create

Re: Help with two issues, buttons and second class object

2016-11-24 Thread Thomas Grops via Python-list
Wow thankyou that code is really good, I had no programming knowledge until 2 months ago, I enjoy your descriptions it is really helpful for me. I like to understand what the code does before using it myself or a variant of it. Will tweak bits tonight the project is in tomorrow. This code is jus

Re: Help with two issues, buttons and second class object

2016-11-24 Thread Larry Hudson via Python-list
On 11/24/2016 06:53 AM, Peter Otten wrote: Thomas Grops via Python-list wrote: [snip...] Instead of repeating your code with copy-and-past make a helper function like the randx() posted by Larry Hudson. By the way, randint(min, max) may return max so there are 9 possible outcomes while you

Re: Help with two issues, buttons and second class object

2016-11-25 Thread Thomas Grops via Python-list
Peter, in your code what does that self.root = root mean in the __init__ function of the class -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with two issues, buttons and second class object

2016-11-25 Thread Thomas Grops via Python-list
Also I am struggling to understand: def move_tank(self, dx, dy): self.x += dx self.y += dy self.canvas.move(self.id, dx, dy) Where does the dx and dy values get input? -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Larry Hudson via Python-list
On 12/05/2016 06:51 PM, Nathan Ernst wrote: IIRC, command.com was a relic of Win9x running on top of DOS and was a 16-bit executable, so inherently crippled (and probably never support by the NT kernel). Whereby cmd.exe coexisted but ran in a 32-bit context. I know my 79-year-old memory is defi

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Larry Hudson via Python-list
On 12/05/2016 10:50 AM, BartC wrote: And just what ARE A, C, and D? It doesn't matter, and is not the concern of the shell. It should restrict itself to the basic parsing that may be necessary when parameters are separated by white-space and commas, if a parameter can contain white-space

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Larry Hudson via Python-list
On 12/06/2016 03:21 AM, BartC wrote: On 06/12/2016 07:37, Larry Hudson wrote: Now you're suggesting the _shell_ is going to read and process a CVS file??? What follows a shell command is a set of values a,b,c,d,e. What is encountered in a CSV is a set of values a,b,c,d,e. You really can't se

Last call for the Call For Proposals of PythonFOSDEM 2017

2016-12-16 Thread Stephane Wirtel via Python-list
Hello, this week-end is the last two days for the Call For Proposals of PythonFOSDEM 2017. We have received a lot of topics, but if you want to become a speaker and that you have a very cool topic to submit, please don't hesite and send us your proposal. Deadline is 2016-12-18. Stephane Cal

data frame

2016-12-23 Thread Val Krem via Python-list
Hi all, #!/usr/bin/env python import sys import csv import numpy as np import pandas as pd a= pd.read_csv("s1.csv") print(a) size w1 h1 0 512 214 26 1 123 250 34 2 234 124 25 3 334 213 43 4 a45 223 32 5 a12 214 26 I wanted to create a new column by adding the t

Re: data frame

2016-12-23 Thread Val Krem via Python-list
ntel/intelpython35/lib/python3.5/site-packages/pandas/indexes/base.py", line 1393, in __getitem__ return getitem(key) IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices On Friday, December 23, 2016 3:09 PM, P

Re: data frame

2016-12-24 Thread Val Krem via Python-list
Thank you Peter and Christ. It is was a white space and the fix fixed it. Many thanks. On Friday, December 23, 2016 5:26 PM, Peter Otten <[email protected]> wrote: Val Krem via Python-list wrote: > Here is the first few lines of the data > > > s1.csv > size,w1,h1 >

data

2016-12-29 Thread Val Krem via Python-list
Hi all, I have a sample of data set and would like to summarize in the following way. ID,class,y 1,12,10 1,12,10 1,12,20 1,13,20 1,13,10 1,13,10 1,14,20 2,21,20 2,21,20 2,21,10 2,23,10 2,23,20 2,34,20 2,34,10 2,35,10 I want get the total count by ID, and the the number of classes by ID. The

RE: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
The best bet (unless you know that you are outputting to a specific place, like html or excel) is to always include the "https://"; or "http://"; since most of the consoles / terminals that support clickable links are parsing them based on "seeing" the initial "http://";. If your output just lo

RE: Re: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
Keeping mind how this all works... Python is providing the data, the console/terminal/app handles how that data is displayed. There is no specification for text output to be hyperlinked (that I know about at least), so while some apps may handle specific coding to tell them that "this text s

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Larry Hudson via Python-list
On 01/03/2017 04:27 PM, Callum Robinson wrote: On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: I doubt it's getting that far (I can see at least one syntax error in the code pasted). True true. In any case, the point is t

RE: Clickable hyperlinks

2017-01-05 Thread Dan Strohl via Python-list
The best bet (unless you know that you are outputting to a specific place, like html or excel) is to always include the "https://"; or "http://"; since most of the consoles / terminals that support clickable links are parsing them based on "seeing" the initial "http://";. If your output just lo

RE: Re: Clickable hyperlinks

2017-01-05 Thread Dan Strohl via Python-list
Keeping mind how this all works... Python is providing the data, the console/terminal/app handles how that data is displayed. There is no specification for text output to be hyperlinked (that I know about at least), so while some apps may handle specific coding to tell them that "this text sho

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Larry Hudson via Python-list
On 01/03/2017 04:27 PM, Callum Robinson wrote: > On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: >> On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: >>> I doubt it's getting that far (I can see at least one syntax error in the >>> code pasted). >> >> True true. In any case, t

crosstab output

2017-01-06 Thread Val Krem via Python-list
Hi all, How do I access the rows and columns of a data frame crosstab output? Here is code using a sample data and output. a= pd.read_csv("cross.dat", skipinitialspace=True) xc=pd.crosstab(a['nam'],a['x1'],margins=True) print(xc) x10 1 nam A13 2 A21 4 I want to create a va

Re: The hardest problem in computer science...

2017-01-06 Thread Larry Hudson via Python-list
On 01/06/2017 05:03 AM, Steve D'Aprano wrote: The second hardest problem in computer science is cache invalidation. The *hardest* problem is naming things. In a hierarchical tree view widget that displays items like this: Fiction ├─ Fantasy │ ├─ Terry Pratchett │ │ ├─ Discw

Python Events in 2017, Need your help.

2017-01-09 Thread Stephane Wirtel via Python-list
Dear Community, For the PythonFOSDEM [1] on 4th and 5th February in Belgium, I would like to present some slides with the Python events around the World. Based on https://python.org/events, I have noted that there are missing events, for example: * PyCon Otto: Italy * PyCon UK: United Kingd

Re: Can not run the Python software

2017-01-13 Thread [email protected] via Python-list
I have been added to the mailing list per your instructions. Please, have someone address the problem belowThanks Sent from my Sprint Phone. -- Original message--From: Date: Thu, Jan 5, 2017 10:13 PMTo: [email protected];Subject:Can not run the Python software Hi, J

Re: Python

2017-01-25 Thread Stephane Wirtel via Python-list
Come to PythonFosdem https://www.python-fosdem.org we will offer some beers on 4 & 5 feb in Brussels > On 25 Jan 2017, at 15:46, Joaquin Alzola wrote: > > > >> Need help > I need a beer > > Put your question in the mailing list I think you can get the help needed. > This email is confidenti

ANN: A new version (0.4.0) of python-gnupg has been released.

2017-01-29 Thread Vinay Sajip via Python-list
A new version of the Python module which wraps GnuPG has been released. What Changed? = This is an enhancement and bug-fix release, and all users are encouraged to upgrade. See the project website [1] for more information. Brief summary: * Added support for ``KEY_CONSIDERED`` in mo

Call for Volunteers at PythonFOSDEM 2017

2017-02-01 Thread Stephane Wirtel via Python-list
# Introduction The Python Community will be represented during FOSDEM 2017 with the Python Devrooms. This year, we will have two devrooms, the first one for 150 people on Saturday and the second one for 450 people on Sunday, it's really cool because we had accepted 24 talks instead of 16. Thi

Re: Python gotcha of the day

2018-03-14 Thread Brian Oney via Python-list
explicit is better than implicit. That gives me an idea for a module with the following debugging command line functionality. import sass >>> "" ":p" Traceback: Are you telling me that ' ' is supposed to an operator? (Rock thrown) On March 14, 2018 10:40:38 AM GMT+01:00, Thomas Jollans wr

<    27   28   29   30   31   32   33   34   35   36   >