Re: empty stdout (subprocess.run)

2022-01-20 Thread James Smith
On Wednesday, January 19, 2022 at 11:14:28 PM UTC-5, cameron...@gmail.com wrote: > But I recommend you use shell=False and make: > > cmd = ["/usr/bin/transmission-remote", "--torrent", str(torrentno), "--info"] I like that. :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Comparing sequences with range objects

2022-04-08 Thread duncan smith
On 08/04/2022 08:21, Antoon Pardon wrote: Op 8/04/2022 om 08:24 schreef Peter J. Holzer: On 2022-04-07 17:16:41 +0200, Antoon Pardon wrote: Op 7/04/2022 om 16:08 schreef Joel Goldstick: On Thu, Apr 7, 2022 at 7:19 AM Antoon Pardon wrote: I am working with a list of data from which I have t

Re: Comparing sequences with range objects

2022-04-09 Thread duncan smith
On 08/04/2022 22:08, Antoon Pardon wrote: Op 8/04/2022 om 16:28 schreef duncan smith: On 08/04/2022 08:21, Antoon Pardon wrote: Yes I know all that. That is why I keep a bucket of possible duplicates per "identifying" field that is examined and use some heuristics at the end

Re: Comparing sequences with range objects

2022-04-10 Thread duncan smith
On 10/04/2022 21:20, Antoon Pardon wrote: Op 9/04/2022 om 02:01 schreef duncan smith: On 08/04/2022 22:08, Antoon Pardon wrote: Well my first thought is that a bitset makes it less obvious to calulate the size of the set or to iterate over its elements. But it is an idea worth exploring

Re: Class - error return

2016-09-06 Thread nospam . Smith
On 06/09/2016 11:23, Peter Otten wrote: > If so look at > >> > ...: def __str__(self): >> > ...: return "Visitor: %i, Contacts: %i % >> > (self.visits,self.contacts)" > once more. Where are the quotes? Where should the be? > > > I solved the problem. thank you Peter -- https

Re: How to pick out the same titles.

2016-10-16 Thread duncan smith
On 16/10/16 16:16, Seymore4Head wrote: > How to pick out the same titles. > > I have a long text file that has movie titles in it and I would like > to find dupes. > > The thing is that sometimes I have one called "The Killing Fields" and > it also could be listed as "Killing Fields" Sometimes

retain dimensions for numpy slice

2016-10-24 Thread duncan smith
Hello, I have several arrays that I need to combine elementwise in various fashions. They are basically probability tables and there is a mapping of axes to variables. I have code for transposing and reshaping that aligns the variables / axes so the usual broadcasting rules achieve the desire

Re: retain dimensions for numpy slice

2016-10-24 Thread duncan smith
On 24/10/16 19:05, Peter Otten wrote: > duncan smith wrote: > >> Hello, >> I have several arrays that I need to combine elementwise in >> various fashions. They are basically probability tables and there is a >> mapping of axes to variables. I have code for tra

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

2016-11-04 Thread duncan smith
On 03/11/16 16:18, 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 similar to one another > > my_nice_string_blabla > my_nice_string_blqbli > my_nice_string_bl0bla >

OSError: [Errno 12] Cannot allocate memory

2016-11-30 Thread duncan smith
Hello, I have had an issue with some code for a while now, and I have not been able to solve it. I use the subprocess module to invoke dot (Graphviz) to generate a file. But if I do this repeatedly I end up with an error. The following traceback is from a larger application, but it appears to

Re: OSError: [Errno 12] Cannot allocate memory

2016-11-30 Thread duncan smith
[snip] Sorry, should have said Python 2.7.12 on Ubuntu 16.04. Duncan -- https://mail.python.org/mailman/listinfo/python-list

Re: OSError: [Errno 12] Cannot allocate memory

2016-11-30 Thread duncan smith
On 30/11/16 17:57, Chris Angelico wrote: > On Thu, Dec 1, 2016 at 4:34 AM, duncan smith wrote: >> >> def _execute(command): >> # shell=True security hazard? >> p = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, >>

Re: OSError: [Errno 12] Cannot allocate memory

2016-11-30 Thread duncan smith
On 30/11/16 17:53, Chris Kaynor wrote: > On Wed, Nov 30, 2016 at 9:34 AM, duncan smith wrote: >> Hello, >> I have had an issue with some code for a while now, and I have not >> been able to solve it. I use the subprocess module to invoke dot >> (Graphviz) to g

Re: OSError: [Errno 12] Cannot allocate memory

2016-11-30 Thread duncan smith
On 01/12/16 00:46, Chris Kaynor wrote: > On Wed, Nov 30, 2016 at 4:12 PM, duncan smith wrote: >> On 30/11/16 17:57, Chris Angelico wrote: >>> On Thu, Dec 1, 2016 at 4:34 AM, duncan smith wrote: >>>> >>>> def _execute(command): >>>> # she

Re: OSError: [Errno 12] Cannot allocate memory

2016-12-01 Thread duncan smith
On 01/12/16 01:12, Chris Kaynor wrote: > On Wed, Nov 30, 2016 at 4:54 PM, duncan smith wrote: >> >> Thanks. So something like the following might do the job? >> >> def _execute(command): >> p = subprocess.Popen(command, shell=False, >>

Re: geopandas bug ?

2017-01-14 Thread duncan smith
On 14/01/17 11:18, Xristos Xristoou wrote: > i want to create a simple spatial joing using geopandas but i thing so > geopandas has bug ? > > > > geopandas code : > > from geopandas import gpd > import geopandas > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc > poly

Re: geopandas bug ?

2017-01-14 Thread duncan smith
On 14/01/17 14:59, Xristos Xristoou wrote: > Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:38:39 μ.μ. UTC+2, ο χρήστης duncan smith > έγραψε: >> On 14/01/17 11:18, Xristos Xristoou wrote: >>> i want to create a simple spatial joing using geopandas but i thing so

Re: Treatment of NANs in the statistics module

2018-03-17 Thread duncan smith
On 16/03/18 23:16, Steven D'Aprano wrote: > The bug tracker currently has a discussion of a bug in the median(), > median_low() and median_high() functions that they wrongly compute the > medians in the face of NANs in the data: > > https://bugs.python.org/issue33084 > > I would like to ask peo

Re: Instance variables question

2018-04-16 Thread duncan smith
On 16/04/18 17:03, Irv Kalb wrote: > I have been writing OOP code for many years in other languages and for the > past few years in Python. I am writing new curriculum for a course on OOP in > Python. In order to see how others are explaining OOP concepts, I have been > reading as many books a

plotly / dash export data

2018-06-09 Thread duncan smith
Hello, I have been trying to work out how to export data from a dash application. I know little about html or javascript. I can upload data into a table as per the example at https://github.com/plotly/dash-core-components/pull/73. I can edit the data in the table. But I can't find a way of ex

Re: Help Needed : script weird result.

2018-09-01 Thread duncan smith
On 01/09/18 18:11, moha...@gmail.com wrote: > All, > > I m trying to run this small script to find the lowest of the given array of > numbers. The script works fine for various combination of inputs but fails in > a weird way for a particular set of inputs, can anyone point the mistake in > the

numpy use cases for where and out

2018-09-11 Thread duncan smith
Hello, I'm writing some code for sparse arrays that is intended to pretty much follow the numpy API. Because my arrays can have different default values there is an issue with using the 'out' keyword argument for functions. e.g. If I elementwise multiply 2 arrays with defaults a and b, then t

Finding .so files without setting LD_LIBRARY_PATH

2016-05-11 Thread Paul Smith
Hi all. I have a locally-built version of Python (2.7.11) that I'm copying around to different systems, running all different versions of GNU/Linux. Because I need this to work across systems I'm bundling important .so's with my Python installation (libcrypto, libssl, libreadline, libgmp) which a

Re: Finding .so files without setting LD_LIBRARY_PATH

2016-05-12 Thread Paul Smith
On Thu, 2016-05-12 at 07:55 +0300, Jussi Piitulainen wrote: > eryk sun writes: > > > On Wed, May 11, 2016 at 10:39 PM, Paul Smith wrote: > > > Hi all. I have a locally-built version of Python (2.7.11) that I'm > > > copying around to different systems, running

Use pip to install non-python?

2016-08-04 Thread Tennis Smith
I have several utility scripts I want to install in /usr/local/bin. Some are python, some are simple bash scripts. Can I use pip to install them? If so, can anyone point me to some examples? Thanks, -T -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do integers compare equal to booleans?

2018-11-16 Thread duncan smith
On 16/11/18 14:51, Steve Keller wrote: > Why do the integers 0 and 1 compare equal to the boolean values False > and True and all other integers to neither of them? > > $ python3 > Python 3.5.2 (default, Nov 12 2018, 13:43:14) > [GCC 5.4.0 20160609] on linux > Type "help", "copyrig

Injecting methods into instance / class

2018-12-02 Thread duncan smith
Hello, I have a lot of functions that take an instance of a particular class as the first argument. I want to create corresponding methods in the class. I have tried the following, which (when called from __init__) creates the relevant methods in an instance (Python 3.6). def init_methods(s

Re: Injecting methods into instance / class

2018-12-02 Thread duncan smith
On 02/12/2018 18:26, Stefan Ram wrote: > duncan smith writes: >> I have tried to find examples of injecting methods into classes without > > Wouldn't the normal approach be to just define a > class with your functions as instance methods? > > main.py >

Re: Injecting methods into instance / class

2018-12-02 Thread duncan smith
On 02/12/2018 18:36, Peter Otten wrote: > duncan smith wrote: > >> Hello, >> I have a lot of functions that take an instance of a particular >> class as the first argument. I want to create corresponding methods in >> the class. I have tried the following, wh

sampling from frequency distribution / histogram without replacement

2019-01-14 Thread duncan smith
Hello, Just checking to see if anyone has attacked this problem before for cases where the population size is unfeasibly large. i.e. The number of categories is manageable, but the sum of the frequencies, N, precludes simple solutions such as creating a list, shuffling it and using the first

Re: sampling from frequency distribution / histogram without replacement

2019-01-14 Thread duncan smith
On 14/01/2019 22:59, Gregory Ewing wrote: > duncan smith wrote: >> Hello, >>   Just checking to see if anyone has attacked this problem before >> for cases where the population size is unfeasibly large. > > The fastest way I know of is to create a list of cum

Re: sampling from frequency distribution / histogram without replacement

2019-01-15 Thread duncan smith
On 15/01/2019 02:41, Spencer Graves wrote: > > > On 2019-01-14 18:40, duncan smith wrote: >> On 14/01/2019 22:59, Gregory Ewing wrote: >>> duncan smith wrote: >>>> Hello, >>>>    Just checking to see if anyone has attacked this problem be

Re: sampling from frequency distribution / histogram without replacement

2019-01-15 Thread duncan smith
On 15/01/2019 17:59, Ian Hobson wrote: > Hi, > > If I understand your problem you can do it in two passes through the > population. > The thing is that I start with the population histogram and I want to generate a sample histogram. The population itself is too large to deal with each population

Re: sampling from frequency distribution / histogram without replacement

2019-01-18 Thread duncan smith
On 14/01/2019 20:11, duncan smith wrote: > Hello, > Just checking to see if anyone has attacked this problem before > for cases where the population size is unfeasibly large. i.e. The number > of categories is manageable, but the sum of the frequencies, N, > precludes simple

in a pickle

2019-03-06 Thread duncan smith
Hello, I've been trying to figure out why one of my classes can be pickled but not unpickled. (I realise the problem is probably with the pickling, but I get the error when I attempt to unpickle.) A relatively minimal example is pasted below. >>> import pickle >>> class test(dict):

Re: in a pickle

2019-03-06 Thread duncan smith
[snip] Sorry, this is Python 3.6 on Linux. Duncan -- https://mail.python.org/mailman/listinfo/python-list

Re: in a pickle

2019-03-06 Thread duncan smith
On 06/03/2019 16:14, duncan smith wrote: > Hello, > I've been trying to figure out why one of my classes can be > pickled but not unpickled. (I realise the problem is probably with the > pickling, but I get the error when I attempt to unpickle.) > > A relatively mi

Re: in a pickle

2019-03-06 Thread duncan smith
On 06/03/2019 20:24, Peter Otten wrote: > duncan smith wrote: > >> On 06/03/2019 16:14, duncan smith wrote: >>> Hello, >>> I've been trying to figure out why one of my classes can be >>> pickled but not unpickled. (I realise the problem is probabl

Re: in a pickle

2019-03-06 Thread duncan smith
On 07/03/2019 00:18, Ethan Furman wrote: > On 03/06/2019 10:30 AM, duncan smith wrote: > >>  I've been trying to figure out why one of my classes can be >> pickled but not unpickled. (I realise the problem is probably with the >> pickling, but I get the error when I

Re: doctest random output?

2019-04-17 Thread duncan smith
On 28/08/2017 20:17, Leam Hall wrote: > On 08/28/2017 11:40 AM, Dennis Lee Bieber wrote: > > ... a bunch of good stuff ... > > I'm (re-)learning python and just trying make sure my function works. > Not at the statistical or cryptographic level.   :) > > Thanks! > > Leam If it's supposed to ge

Re: Import module from a different subdirectory

2019-05-16 Thread duncan smith
On 16/05/2019 22:50, Rich Shepard wrote: > I'm developing a Python3 application using Python3-3.7.3 and > virtualenv-16.5.0 on a Slackware-14.2 host. > > The project directory contains subdirectories, including gui/ (with the > tkinter views) and classes/ with the SQLAlchemy model.py. > > Within

duck typing / library functions

2019-09-12 Thread duncan smith
Hello, The problem I have relates to writing algorithmic code that can handle types with a given API, but where some of the required functionality is implemented as library functions rather than methods. Specifically I have code that uses numpy arrays, but I want to adapt it to use sparse arr

Re: Instantiating sub-class from super

2019-10-15 Thread duncan smith
On 15/10/2019 21:36, DL Neil wrote: > On 16/10/19 12:38 AM, Rhodri James wrote: >> On 14/10/2019 21:55, DL Neil via Python-list wrote: > ... > >>> It seemed better (at the design-level) to have Man( Person ) and >>> Woman( Person ) sub-classes to contain the pertinent attributes, >>> source more d

Re: Instantiating sub-class from super

2019-10-16 Thread duncan smith
On 16/10/2019 04:41, DL Neil wrote: > On 16/10/19 1:55 PM, duncan smith wrote: >> On 15/10/2019 21:36, DL Neil wrote: >>> On 16/10/19 12:38 AM, Rhodri James wrote: >>>> On 14/10/2019 21:55, DL Neil via Python-list wrote: >>> ... >>> So, yes, the &q

Re: Instantiating sub-class from super

2019-10-16 Thread duncan smith
On 16/10/2019 19:52, MRAB wrote: > On 2019-10-16 19:43, duncan smith wrote: >> On 16/10/2019 04:41, DL Neil wrote: >>> On 16/10/19 1:55 PM, duncan smith wrote: >>>> On 15/10/2019 21:36, DL Neil wrote: >>>>> On 16/10/19 12:38 AM, Rhodri James wrote: &

Re: Instantiating sub-class from super

2019-10-19 Thread duncan smith
On 18/10/2019 23:57, DL Neil wrote: > On 17/10/19 7:52 AM, MRAB wrote: >> On 2019-10-16 19:43, duncan smith wrote: >>> On 16/10/2019 04:41, DL Neil wrote: >>>> On 16/10/19 1:55 PM, duncan smith wrote: >>>>> On 15/10/2019 21:36, DL Neil wrote: &g

Re: stuck on time

2019-12-08 Thread duncan smith
On 07/12/2019 17:48, RobH wrote: > I am trying to do this project on a pi zero: > > http://frederickvandenbosch.be/?p=1365 > > After overcoming a few errors, I now have the display working and the > start of the code showing on the display, that being the time. > > It doesn't move on to the next

distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread duncan smith
Hello, Not really specific to Python or matplotlib (but that's what I'm using). I'm looking for a good combination of colours and symbols for scatter plots, and combination of colours and line styles for line plots. Too often I find myself producing these when I don't know whether they will e

Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread duncan smith
On 16/12/2019 21:08, DL Neil wrote: > On 17/12/19 5:19 am, Chris Angelico wrote: >> On Tue, Dec 17, 2019 at 3:16 AM duncan smith >> wrote: >>> >>> Hello, >>>    Not really specific to Python or matplotlib (but that's what I'm >>&

Re: What I learned today

2020-02-14 Thread duncan smith
On 14/02/2020 23:21, Dan Stromberg wrote: > On Fri, Feb 14, 2020 at 3:10 PM Stefan Ram wrote: > >> By trial and error (never read documentation!) I found >> that you can count the number of e's in a text by just >> >> Counter( text ).get( 'e' ) >> >> (after »from collections import Counter«

queue versus list

2020-03-19 Thread duncan smith
Hello, I have generator code along the following lines, Q = queue.Queue() Q.put(x) while not Q.empty(): x = Q.get() if : yield x else: Q.put() If I change it to, Q = [] Q.append(x) for x in Q: if : yield x else: Q.append() then it runs a

Re: queue versus list

2020-03-19 Thread duncan smith
On 19/03/2020 20:40, MRAB wrote: > On 2020-03-19 20:08, duncan smith wrote: >> Hello, >>    I have generator code along the following lines, >> >> >> Q = queue.Queue() >> Q.put(x) >> while not Q.empty(): >> x = Q.get() >>   

Re: queue versus list

2020-03-20 Thread duncan smith
On 20/03/2020 21:57, Barry wrote: > > >> On 20 Mar 2020, at 00:42, duncan smith wrote: >> >> Bingo. Performance is indistinguishable from that of the list. Thread >> safety is unimportant (for my purposes), but the docs at >> https://docs.python.org/2/librar

inheriting from long on Python2 or int on Python3

2020-03-21 Thread duncan smith
Hello, I have a class I wrote for Python2 that needs to be made to work on Python3. On Python2 it inherited from long, so it needs to inherit from int on Python3. The following works, but I'm not sure it's the cleanest solution. It's the first time I've wanted / needed to make a parent class

Re: inheriting from long on Python2 or int on Python3

2020-03-21 Thread duncan smith
On 21/03/2020 21:55, Skip Montanaro wrote: >> import sys >> >> class C_hash(int if sys.version_info.major >= 3 else long): > ... > > There's nothing incorrect with your solution. Chris offered another. I > was going to suggest you consider running your code through 2to3 to > see what it does. I cr

RE: Confusing textwrap parameters, and request for RE help

2020-03-29 Thread Steve Smith
I am having the same issue. I can either get the text to wrap, which makes all the text wrap, or I can get the text to ignore independent '/n' characters, so that all the blank space is removed. I'd like to set up my code, so that only 1 blank space is remaining (I'll settle for none at this poi

=+ for strings

2020-05-03 Thread James Smith
I tried: dt=+"{:02d}".format(day) but I got: dt=+"{:02d}".format(day) TypeError: bad operand type for unary +: 'str' This works: dt=dt+"{:02d}".format(day) Why can't I do the shortcut on strings? -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused about np.polyfit()

2020-07-19 Thread duncan smith
On 19/07/2020 11:19, Dino wrote: > > Hi, I am looking at someone else's code trying to understand their use > of numpy.polyfit. > > My understanding was that you can use it to fit polynomials, but > apparently, the original author has used it for logarithmic and > exponential curves as well this

Re: Confused about np.polyfit()

2020-07-19 Thread duncan smith
On 19/07/2020 16:11, Dino wrote: > On 7/19/2020 4:54 PM, duncan smith wrote: >> >> It depends on what you expect the result to be. There's nothing >> inherently wrong with transforming variables before using least squares >> fitting. Whether it gives you the "

Re: Find word by given characters

2020-11-01 Thread duncan smith
On 01/11/2020 13:38, Bischoop wrote: > On 2020-11-01, Bischoop wrote: >> I'm working on a script i which user inputs letters and then a printed >> words containing those letters. The scripts works however I can't solve >> one problem , it prints also words in which these letters occur more >> tha

Re: Find word by given characters

2020-11-02 Thread duncan smith
On 02/11/2020 19:09, dn wrote: > On 02/11/2020 23:29, Bischoop wrote: >> On 2020-11-01, duncan smith wrote: >>>> >>> >>> But this generates the letters counts for each word. They only need to >>> be generated once (outside the for loop). And usi

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 14:06, Bischoop wrote: > On 2020-11-03, dn wrote: >> >> >> The (full) specs are not clear. There's certainly room for >> misunderstanding. I'd be happier if I could 'see' a full spec or >> recognise a practical application, because then we'd be better able to >> discuss facts. Mea

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 23:35, Bischoop wrote: > On 2020-11-03, duncan smith wrote: >>> >> >>>>> from collections import Counter >>>>> letters = 'att' >>>>> letter_counts = Counter(letters) >>>>> word = 'tolerate

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 22:14, Avi Gross wrote: > I, too, have wondered what exactly the point was of the required > functionality for SCRABBLE but note you can extend a current word so > additional letters may be available in a game but only if they are an exact > fit to put before, after, or in middle of y

Re: Find word by given characters

2020-11-04 Thread duncan smith
On 04/11/2020 04:21, Avi Gross wrote: > Duncan, my comments below yours at end. > > ---YOURS--- > The Counter approach only requires iterating over the letters once to > construct the letters bag, then each word once to create the relevant word > bag. After that it's (at worst) a couple of lookups

Re: Find word by given characters

2020-11-04 Thread duncan smith
On 04/11/2020 19:12, Avi Gross wrote: > My comments at end: > > -Original Message- > From: Python-list On > Behalf Of duncan smith > Sent: Wednesday, November 4, 2020 1:09 PM > To: python-list@python.org > Subject: Re: Find word by given characters > >

Re: What is "self"?

2005-09-23 Thread Roy Smith
Ron Adam <[EMAIL PROTECTED]> wrote: > You can actually call it anything you want but "self" is sort of a > tradition. That's true, but I think needs to be said a bit more emphatically. There's no reason to call it anything other than "self" and a newcomer to the language would be well advised

Re: Calling Access module functions from python

2005-09-23 Thread Chris Smith
> "kayakerjess" == kayakerjess <[EMAIL PROTECTED]> writes: kayakerjess> Hi, I have an Access Data Project (.adp) that I am kayakerjess> trying to open and execute from Python. I am using kayakerjess> the win32com.client, and I have successfully opened kayakerjess> the applica

Re: Carrying variables over from function to function

2005-09-25 Thread Roy Smith
"Ivan Shevanski" <[EMAIL PROTECTED]> wrote: > Alright heres my problem. . .Say I want to carry over a variable from one > function to another or even another run of the same function. Is that > possible? You want one of two things. The most obvious would be a global variable. Something like th

Virgin keyword (Was: Will python never intend to support private, protected and public?)

2005-10-02 Thread Roy Smith
"El Pitonero" <[EMAIL PROTECTED]> wrote: > Python's lack of Java-style "private" surely has its drawback: name > collisions can happen. But, that's just one side. Name collisions are > allowed in many dynamic languages, where you can override the default > system behavior (in some languages, you ca

catching all tracebacks

2005-10-05 Thread Timothy Smith
iw ant to use a singel try except statment with my main app loop in the middle and catch all tracebacks and email them to myself as a bug report. however it seems a little more tricky then i thought try: Main.Main() except Exception, err_o: print err_o.__class__.__name__, '//', err_o, '/

Re: catching all tracebacks

2005-10-05 Thread Timothy Smith
Timothy Smith wrote: >iw ant to use a singel try except statment with my main app loop in the >middle and catch all tracebacks and email them to myself as a bug >report. however it seems a little more tricky then i thought > >try: >Main.Main() >except Exception, er

non descriptive error

2005-10-06 Thread Timothy Smith
i try to run my app and i get this %python DutyShift.py error thats it. thats the error. mya pp was previously working, and i did make some fairly large changes to it, but i'd expect a more descriptive message then just "error". anyidea where i need to start looking? -- http://mail.python.org

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Roy Smith
"Ben Sizer" <[EMAIL PROTECTED]> wrote: > It's started to get very misleading - Python gives you plenty of > type-checking, as we all know, just not at compile-time. There's more to it than just that. Python's type checking is not just not done at compile time, it's done as late in run time as po

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Roy Smith
Paul Rubin wrote: > What this is about (to me at least) is the edit-debug cycle. Let's > say I write some Python code, using assert to validate datatypes. > Maybe I've made 4 errors. I then write a test function and run it. > Boom, the first assert fails. I fix the fir

Re: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-10-07 Thread Duncan Smith
Rocco Moretti wrote: > Steve Holden wrote: > >>> On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards <[EMAIL PROTECTED]> >>> wrote: > > For example: In British English one uses a plural verb when the subject consists of more than one person. Sports teams, government departments, st

Re: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-10-08 Thread Duncan Smith
Steve Holden wrote: > Duncan Smith wrote: > >> Rocco Moretti wrote: > > [...] > >> >> So English is spoken only in the South East of England, except London? >> I think you should also disbar the queen (unless she's already >> classified as a Lo

Re: non descriptive error

2005-10-09 Thread Timothy Smith
Terry Hancock wrote: >On Thursday 06 October 2005 11:57 pm, Timothy Smith wrote: > > >>i try to run my app and i get this >> >>%python DutyShift.py >>error >> >>thats it. thats the error. mya pp was previously working, and i did make >>som

Re: non descriptive error

2005-10-09 Thread Timothy Smith
i have reproduced the error in this code block #save values in edit self.FinaliseTill.SaveEditControlValue() if Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance'])) == Decimal('0'): #box must be ch

Re: non descriptive error

2005-10-09 Thread Timothy Smith
Timothy Smith wrote: >i have reproduced the error in this code block > >#save values in edit > self.FinaliseTill.SaveEditControlValue() > if >Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalanc

Re: non descriptive error

2005-10-09 Thread Timothy Smith
[EMAIL PROTECTED] wrote: >On Mon, Oct 10, 2005 at 09:12:13AM +1000, Timothy Smith wrote: > > >>FAYI i have already found it and it was a wrongly indented code block :/ >> >> > >When indentation leaves an illegal program structure, Python gives a very &g

Re: non descriptive error

2005-10-09 Thread Timothy Smith
Neil Hodgson wrote: >Timothy Smith: > > > >>FYI i have located where the problem was. in the first if statement >>there was an unbalanced ). now since when does python not give a >>descriptive error for that? >> >> > >I see this with the

Re: non descriptive error

2005-10-11 Thread Timothy Smith
Fredrik Lundh wrote: >Timothy Smith wrote: > > >>i have reproduced the error in this code block >> >>#save values in edit >>self.FinaliseTill.SaveEditControlValue() >>if >>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()][&#

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Chris Smith
> "Sebastian" == Sebastian Bassi <[EMAIL PROTECTED]> writes: Sebastian> On 9/30/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >> after Guido's pronouncement yesterday, in one of the next >> versions of Python there will be a conditional expression with >> the following syn

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Roy Smith
Chris Smith <[EMAIL PROTECTED]> wrote: >What I really want to do is take four lines of conditional, and put >them into one, as well as blow off dealing with a 'filler' variable: > >return "the answer is " + "yes" if X==0 else "no" I woul

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-13 Thread Chris Smith
>>>>> "Duncan" == Duncan Booth <[EMAIL PROTECTED]> writes: Duncan> Chris Smith wrote: >> What I really want to do is take four lines of conditional, and >> put them into one, as well as blow off dealing with a 'filler' >&g

Re: Dealing with Excel

2005-10-18 Thread Chris Smith
> "Robert" == Robert Hicks <[EMAIL PROTECTED]> writes: Robert> I need to pull data out of Oracle and stuff it into an Robert> Excel spreadsheet. What modules have you used to interface Robert> with Excel and would you recommend it? Robert> Robert For simple enough tasks, I th

Re: Python vs Ruby

2005-10-19 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Amol Vaidya" <[EMAIL PROTECTED]> wrote: > Hi. I am interested in learning a new programming language, and have been > debating whether to learn Ruby or Python. How do these compare and contrast > with one another, and what advantages does one language provide ov

Re: Python vs Ruby

2005-10-19 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "jean-marc" <[EMAIL PROTECTED]> wrote: > I'd believe that would be Lua, but then again what is common to one > might not be to another ;-) Dang, you're right! Lua's got Ruby beat two-fold! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-21 Thread Roy Smith
Robert Boyd <[EMAIL PROTECTED]> wrote: > As if Plone, Zope, and (non-Python) Shibboleth weren't getting me > enough funny looks. And I haven't even started telling co-workers > about Django. A couple of years ago, a head-hunter asked me if I knew Plone. I figured he was just being an idiot and d

Re: Generic utility class for passing data

2005-10-29 Thread Chris Smith
> "Gordon" == Gordon Airporte <[EMAIL PROTECTED]> writes: Gordon> I'm wondering if this is might be bad practice. Sometimes Gordon> when I need to pass around several pieces of datum I will Gordon> put them in a tuple, then when I need to use them in a Gordon> receiving functio

Re: String Identity Test

2005-11-01 Thread Roy Smith
Duncan Booth <[EMAIL PROTECTED]> wrote: > If 'a!=b' then it will also be the case that 'a is not b' That's true for strings, and (as far as I know), all pre-defined types, but it's certainly possible to define a class which violates that. class isButNotEqual: def __ne__ (self, other):

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Roy Smith
Stuart Turner <[EMAIL PROTECTED]> wrote: > "Python is a scripting language like Perl, awk, tcl, Java etc... It is difficult to say whether Python is a scripting language or not until you define what you mean by "scripting language". People throw the term "scripting language" around with wild a

Re: Underscores in Python numbers

2005-11-08 Thread Roy Smith
Dave Hansen <[EMAIL PROTECTED]> wrote: > Of course, I write _far_ more code in C than Python. But I've seen > enough bugs of the sort where someone wrote 120 when they meant > 1200, that I see great value in being able to specify 12_000_000. I'll admit that being able to write 12_000_000

Re: append to non-existing list

2005-11-09 Thread Roy Smith
Yves Glodt <[EMAIL PROTECTED]> wrote: > My question is: Is there no way to append to a non existing list? Nope. The problem (well, part of the problem, anyway) is that when you do: foo.append (bar) what's happening is you're calling foo's append method. If foo doesn't already exist, it has n

Re: append to non-existing list

2005-11-09 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Yves Glodt <[EMAIL PROTECTED]> wrote: > > You mean you want to type "pkcolumns" only once to keep your code short? > > Would something like this be useful? > > > > pkcolumns = [row.strip() for row in sqlsth] > > I will look into this, maybe it's what I need, than

Re: Python obfuscation

2005-11-10 Thread Timothy Smith
> Reliability is >important but so is protecting your code in an effective manner > > there is no way to prevent people disassembling your code compiled or otherwise. once you give then the program they can easily take it apart. no if's, no but's; do NOT rely on binary's for security. > >the

Re: Needed class whose instances are many test cases

2005-11-11 Thread Chris Smith
> "Sumit" == Sumit <[EMAIL PROTECTED]> writes: Sumit> I have scinario like I have to Create resource(in Sumit> __init__()) Before Running a set of testcases and then In Sumit> Testcases resources are going to used and then It will Sumit> cleared off after Running the testcases

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-11 Thread Roy Smith
"Robert Hicks" <[EMAIL PROTECTED]> wrote: > Why does there need to be OO "in the core"? That is one thing I have > never understood. If you want OO, get a package that fits your style of > OO and "package require" you are off and running. That probably isn't > what you would be looking at Tcl for a

Re: Needed class whose instances are many test cases

2005-11-11 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > This is a poor design; your tests will each be starting in a different > state, and will likely not run the same way if run in a different > order, making them fragile. > > Test cases should each run individually, from a kno

<    3   4   5   6   7   8   9   10   11   12   >