Re: on writing a while loop for rolling two dice

2021-09-11 Thread Andrew Jaffe
On 11/09/2021 10:09, dn via Python-list wrote: The stated requirement is: "I'd like to get the number of times I tried". Given such: why bother with returning any of the pairs of values? Indeed, if that's the requirement, then you can do even better, noting that the probability of getting a

Re: better handling of "pinned" modules?

2021-01-08 Thread Andrew Jaffe
On 08/01/2021 18:21, Chris Angelico wrote: On Sat, Jan 9, 2021 at 5:18 AM Andrew Jaffe wrote: Hi, I don't know if this makes more sense here or on "python-ideas" (or elsewhere?) but I'll try this first: I am starting to encounter more and more instances of packages req

better handling of "pinned" modules?

2021-01-08 Thread Andrew Jaffe
Hi, I don't know if this makes more sense here or on "python-ideas" (or elsewhere?) but I'll try this first: I am starting to encounter more and more instances of packages requiring older, pinned, versions of modules, and this is occasionally actually starting to cause conflicts. It seems

Re: [Beginner] Spliting input

2020-06-25 Thread Andrew Jaffe
Hi, On 25/06/2020 12:50, Bischoop wrote: I try to split input numbers, for example: 12 so I cant add them, I tried separated split(' ') but it's not working. Any ideas how to do this? * numb1,numb2=input("enter 1st and 2nd no ").split() Avg=(int(numb1) + int(numb2)) / 2 print(Avg) So, this i

Re: Behaviour of os.path.join

2020-05-27 Thread Andrew Jaffe
Dear all, \On 26/05/2020 15:56, BlindAnagram wrote: I came across an issue that I am wondering whether I should report as an issue. If I have a directory, say: base='C:\\Documents' and I use os.path.join() as follows: join(base, '..\\..\\', 'build', '') I obtain as expected from the d

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Andrew Jaffe
On 06/03/2016 14:41, Steven D'Aprano wrote: On Sun, 6 Mar 2016 10:34 pm, Tony van der Hoff wrote: Hi, I've been experimenting with a short test program under python 2.7 and python 3.4.2. It's a simple read from file, and locate a word therein. I get the (subjective) impression that python2 is

OS X Python: can I explicitly set MACOSX_DEPLOYMENT_TARGET for extensions?

2015-10-19 Thread Andrew Jaffe
I use the python.org framework build of Python under recent versions of OS X (i.e., 10.11 El Capitan). I need to build some extensions that rely on recent versions of compilers (e.g., C++-11 features). However the python.org python is built to work on older systems as well, for backward compati

Re: Question About Running Python code

2014-10-16 Thread Andrew Jaffe
On 15/10/2014 23:50, ryguy7272 wrote: The error that I get is this. 'invalid syntax' The second single quote in this line is highlighted pink. print 'Downloading data from Yahoo for %s sector' % sector This is a script written for Python 2.*, but you say you are using Python 3.4. In Python 3,

Re: Log base 2 of large integers

2014-08-13 Thread Andrew Jaffe
On 13/08/2014 14:46, Mok-Kong Shen wrote: Am 13.08.2014 15:32, schrieb Steven D'Aprano: Mok-Kong Shen wrote: I like to compute log base 2 of a fairly large integer n but with math.log(n,2) I got: OverflowError: long int too large to convert to float. Is there any feasible work-around for th

Re: Python 3 on Mac OS X 10.8.4

2014-06-19 Thread Andrew Jaffe
On 19/06/2014 08:02, Une BĂ©vue wrote: On my mac i do have : $ python --version Python 2.7.2 I want to install Python 3 such as python-3.4.0-macosx10.6.dmg avoiding disturbing the "built-in" version. Is that possible ? The python.org packages are explicitly created in order to have no conflict

Re: classmethods, class variables and subclassing

2005-10-21 Thread Andrew Jaffe
Steven Bethard wrote: > Andrew Jaffe wrote: > > I'm not sure if I understand your goal here, but you can get different > behavior using super(). > > py> class sup(object): > ... cvar1 = None > ... cvar2 = None > ... @classmet

Re: classmethods, class variables and subclassing

2005-10-21 Thread Andrew Jaffe
Steve Holden wrote: > Andrew Jaffe wrote: >> Steve Holden wrote: >>> Andrew Jaffe wrote: >>> >>>> The problem is that I actually do want to call these methods on the >>>> class itself, before I've made any instances. >>>> &g

Re: classmethods, class variables and subclassing

2005-10-21 Thread Andrew Jaffe
Steve Holden wrote: > Andrew Jaffe wrote: > >>The problem is that I actually do want to call these methods on the >>class itself, before I've made any instances. >> > Except you could use staticmethods with an explicit class argument ... Steve, Yep, that would

Re: classmethods, class variables and subclassing

2005-10-20 Thread Andrew Jaffe
> Andrew Jaffe wrote: > >> Hi, >> >> I have a class with various class-level variables which are used to >> store global state information for all instances of a class. These are >> set by a classmethod as in the following >> >> class sup(ob

classmethods, class variables and subclassing

2005-10-20 Thread Andrew Jaffe
Hi, I have a class with various class-level variables which are used to store global state information for all instances of a class. These are set by a classmethod as in the following (in reality the setcvar method is more complicated than this!): class sup(object): cvar1 = None cvar