Test if Script Already Running

2017-04-18 Thread Matt
I have a number of simple scripts I run with cron hourly on Centos linux. I want the script to check first thing if its already running and if so exit. In perl I did it with this at the start of every script: use Fcntl ':flock'; INIT { open LH, $0 or die "Can't open $0 for lockin

Re: New to Python - Career question

2017-06-07 Thread Matt
On Tuesday, June 6, 2017 at 3:37:56 PM UTC-7, Marko Rauhamaa wrote: > pta...@gmail.com: > > > New to Python and have been at it for about a month now. I'm doing > > well and like it very much. Considering a career change down the road > > and have been wondering... What are the job prospects for a

Test String Contents

2017-06-13 Thread Matt
What is easiest way to determine if a string ONLY contains a-z upper or lowercase. I also want to allow the "-" and "_" symbols. No spaces or anything else. -- https://mail.python.org/mailman/listinfo/python-list

Re: python backup script

2013-05-06 Thread Matt Jones
I've never used ConfigParser either, but shouldn't the "[client]" section have the options "mmz", "pass1", or "localhost" somewhere? Do you need to add them to that file? *Matt Jones* On Mon, May 6, 2013 at 2:20 PM, MMZ wrote: > On M

Re: python backup script

2013-05-06 Thread Matt Jones
ients [client] #password = your_password port= 3306 socket = /tmp/mysql.sock mmz = bleh pass1 = blah localhost = bluargh *Matt Jones* On Mon, May 6, 2013 at 3:37 PM, MMZ wrote: > Thanks Matt. > my.cnf is a readonly file and cannot be

Re: Question about ast.literal_eval

2013-05-20 Thread matt . newville
his works by maintaining an internal namespace (a flat dictionary), and walking the AST generated for the expression. It supports most Python syntax, including if, for, while, and try/except blocks, and function definitions, and with the notable exceptions of eval, exec, class, lambda, yield, and i

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Matt Jones
This typically indicates that the "peer" at the other end of the tcp connection severed the session without the typical FIN packet. If you're treating the printer as a "blackbox" then there really isn't anything you can do here except catch the exception and atte

String object has no attribute "append"

2013-05-28 Thread Matt Graves
I receive this error while toying around with Functions... def pulldata(speclist,speccolumn): with open('profiles.csv', 'r') as f: reader = csv.reader(f) for column in reader: (speclist).append(column[('speccolumn')]) pulldata(speclist = 'numbers',

Need to modify a Python Gui

2013-06-01 Thread matt . doolittle33
Hi everybody, I have a Python GUI that displays some data in labeled fields. As new data comes in the fields clear and the old data is lost. I need to make a text box in the GUI that will display the cleared data in a scrolling list. I also need this scrolling list to be logged to a file in c

Python HTTP POST

2013-07-17 Thread Matt Graves
I am going to be creating a python script that will make filling in information at my job easier. I have all of the information I need... I guess I just need to see it in practice to fully grasp it. How would I submit a python HTTP POST request to... for example, go to google.com, enter "Pie"

Re: Considering taking a hammer to the computer...

2013-01-01 Thread Matt Jones
ms or rooms_on_floor is received from the user. something like...: rooms_on_floor = int(input("Enter the number of rooms on floor: ")) total_rooms += rooms_on_floor *Matt Jones* On Tue, Jan 1, 2013 at 2:14 PM, wrote: > OK, thank you all for your help yesterday! > > Here

Re: building python from source

2013-01-03 Thread Matt Jones
Run the unittests. the "test___all___.py" test runner can be found under your python installation directory's lib/python-X.X/test/. *Matt Jones* On Thu, Jan 3, 2013 at 8:43 AM, Rita wrote: > For those building python from source what are some tests you do to make > sur

Re: Question on for loop

2013-01-03 Thread Matt Jones
nt key, value However I'm still not sure why you'd want to do this. *Matt Jones* On Thu, Jan 3, 2013 at 2:21 PM, MRAB wrote: > On 2013-01-03 20:04, subhabangal...@gmail.com wrote: > >> Dear Group, >> If I take a list like the following: >> >> fruits = [

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread matt . newville
ule to "compile" an expression into the AST, then walks through that, intercepting Name nodes and using a flat namespace of variables. It disallows imports and does not support all python constructs, but it is a fairly complete in supporting python syntax. It makes no claim at actually being safe from malicious attack, but should be safer than a straight eval(), and prevent accidental problems when evaluating user-input as code. If anyone can find exploits within it, I'd be happy to try to fix them. --Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Class confusion

2013-01-09 Thread Matt Jones
you wrote would work, only return those literals thought, you'd want to do something meaningful inside of SystemList's methods. *Matt Jones* On Wed, Jan 9, 2013 at 3:28 PM, MRAB wrote: > On 2013-01-09 20:13, Rodrick Brown wrote: > >> How can I make a class that has methods wi

Re: Class confusion

2013-01-09 Thread Matt Jones
Does this look sufficient for what? You haven't actually told us what it is you're trying to accomplish. I gave you the "how", you must supply the "why". *Matt Jones* On Wed, Jan 9, 2013 at 6:43 PM, Rodrick Brown wrote: > Can anyone care to advise on the

Re: help

2013-01-11 Thread Matt Jones
Pay isn't linked to the "people" in any way. A dictionary would serve this purpose better (at least in this simple example). database = { 'Mac' : 1000, 'Sam' : 2000 } name = raw_input('Enter your name:') if name in database.keys(): print

Re: Using inner dict as class interface

2013-01-16 Thread Matt Jones
Explicit is better than implicit. Define the dunder methods so you know exactly what your class is doing when being indexed. You only need __getitem__ and __setitem__ really, but if you want to treat it just like a dict you'll need __delitem__, __len__, __iter__, __contains__ as well.

Re: Using inner dict as class interface

2013-01-16 Thread Matt Jones
Or do what Steven said if its exactly a dict and doesn't require special management of the underlying dict. *Matt Jones* On Wed, Jan 16, 2013 at 8:58 AM, Matt Jones wrote: > Explicit is better than implicit. Define the dunder methods so you know > exactly what your class is doing

Re: Inconsistent behaviour of methods waiting for child process

2013-01-18 Thread Matt Jones
What version of python and os are you running? *Matt Jones* On Fri, Jan 18, 2013 at 6:04 AM, Marcin Szewczyk wrote: > Hi, > > I've done some experiments with: > 1) multiprocessing.Process.join() > 2) os.waitpid() > 3) subprocess.Popen.wait() > > These three method

Re: Slightly OT: What metro areas are best for a software development career?

2013-01-21 Thread Matt Jones
field/?SiteId=cbmsn43218&sc_extcmp=JS_3218_advice *Matt Jones* On Mon, Jan 21, 2013 at 10:18 AM, Jason Hsu wrote: > I am looking for a position as a software development engineer. I'm > currently learning to develop Android apps ( > http://www.jasonhsu.com/android-apps

Re: Cancel threads after timeout

2013-01-26 Thread Matt Jones
x27;s warning though that the SQL Server my still be working even if you cancel an operation from the outside (which could compound your problem). *Matt Jones* On Sat, Jan 26, 2013 at 9:43 AM, Jason Friedman wrote: > > Sometimes it happens that a query on one of the database servers > >

setting the length of the backtrace output in pdb

2012-02-27 Thread Matt Funk
Hi, this might be a rather silly question, but i cannot figure out how to make pdb give me more than 10 lines of output whenever i issue a backtrace command. Is there an easy way to do this? thanks matt -- http://mail.python.org/mailman/listinfo/python-list

Python Developer Job Opportunities

2012-03-02 Thread Matt Jones
I have an opportunity for talented Python Developers with Django experience based in the South of the UK. I am recruiting for a funded new venture set up by two successful entrepreneurs who are experienced and well--respected scientists and mathematicians. They're building a new and radical way

Condition in C API

2012-03-22 Thread Matt Joiner
Is there a Condition-like object exposed in the CPython C API? I've found PyThread_lock_type, but nothing condition-like. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Matt Chaput
On 13/06/2011 11:55 PM, zainul franciscus wrote: Iknow you guys must be thinking "Hmm, Miranda, isn't that an IM application ?"; Yep I hear you, I'll change the name once I get a good name. I am open for any suggestions. Actually I was thinking "isn't that a functional programming language?" M

shouldn't ctypes cast as it does in C?

2011-08-11 Thread Matt Joiner
http://www.mememaker.net/images/public/201108110739296015.jpg -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] allow line break at operators

2011-08-11 Thread Matt Joiner
+0.5 The "trailing \" workaround is nonobvious. Wrapping in () is noisy and already heavily used by other syntactical structures. Since a final ':' is needed anyway, i think this would be great. if a and b or c: do stuff() On Thu, Aug 11, 2011 at 11:02 PM, MRAB wrote: > On 11/08/2011 05:16

Help with regular expression in python

2011-08-18 Thread Matt Funk
this does not work. I'd really like to understand it if someone can shed light on it. thanks matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regular expression in python

2011-08-18 Thread Matt Funk
0)\t:\tsome description')] btw: The line to be matched (given below) is ONE line. There are no line breaks (even though my email client adds them). matt On Thursday, August 18, 2011, Vlastimil Brom wrote: > 2011/8/18 Matt Funk : > > Hi, > > i am sorry if this doesn't

Re: Help with regular expression in python

2011-08-19 Thread Matt Funk
Hi Josh, thanks for the reply. I am no expert so please bear with me: I thought that the {32} was supposed to match the previous expression 32 times? So how can i have all matches accessible to me? matt On Thursday, August 18, 2011, Josh Benner wrote: > On Thu, Aug 18, 2011 at 4:03 PM, M

Re: Help with regular expression in python

2011-08-19 Thread Matt Funk
7;t figure out why it doesn't work. I.e. why the expression is not matches {32} times. I just don't get it. anyway, thanks though matt On 8/19/2011 8:41 AM, Jason Friedman wrote: >> Hi Josh, >> thanks for the reply. I am no expert so please bear with me: >> I thought t

Re: Help with regular expression in python

2011-08-19 Thread Matt Funk
On Friday, August 19, 2011, Alain Ketterlin wrote: > Matt Funk writes: > > thanks for the suggestion. I guess i had found another way around the > > problem as well. But i really wanted to match the line exactly and i > > wanted to know why it doesn't work. That

Re: Help with regular expression in python

2011-08-19 Thread Matt Funk
On Friday, August 19, 2011, jmfauth wrote: > On 19 août, 19:33, Matt Funk wrote: > > The results obtained are: > > results: > > [(' 2.199000e+01', ' : (instance: 0)\t:\tsome description')] > > so this matches the last number plus the string a

Re: Help with regular expression in python

2011-08-19 Thread Matt Funk
On Friday, August 19, 2011, Carl Banks wrote: > On Friday, August 19, 2011 10:33:49 AM UTC-7, Matt Funk wrote: > > number = r"\d\.\d+e\+\d+" > > numbersequence = r"%s( %s){31}(.+)" % (number,number) > > instance_linetype_pattern = re.compile(numberse

Re: [Python-ideas] allow line break at operators

2011-09-01 Thread Matt Joiner
I guess the issue here is that you can't tell if an expression is complete without checking the indent of the following line. This is likely not desirable. On Thu, Sep 1, 2011 at 11:43 PM, Yingjie Lan wrote: > Hi Matt, > === > Fro

Re: help with regex matching multiple %e

2011-03-03 Thread Matt Funk
Thanks, works great. matt On 3/3/2011 10:53 AM, MRAB wrote: > On 03/03/2011 17:33, maf...@nmsu.edu wrote: >> Hi, >> >> i have a line that looks something like: >> 2.234e+04 3.456e+02 7.234e+07 1.543e+04: some description >> >> I would like to extract all

question about endswith()

2011-03-03 Thread Matt Funk
t the hdf5 file. Is there anything i am doing wrong? thanks matt -- http://mail.python.org/mailman/listinfo/python-list

Re: question about endswith()

2011-03-03 Thread Matt Funk
sted): for filename in files: if (any(filename.endswith(x) for x in extensions)): print filename However, it will print all the files in list 'files' (that is all files with file extension '.hdf'). My question is why it doesn't just print the

Re: question about endswith()

2011-03-04 Thread Matt Funk
2733.hdf','MOD03.A2010002.1950.005.2010258063105.hdf','MOD03.A2010002.1950.005.2010258063105.hdf5') for filename in files: if (any(filename.endswith(x) for x in extensions)): print filename thanks for the help matt On 3/4/2011 2:26 AM, Tom Zych wrote: > Ethan Furman wrote: >> Wh

Re: Finding keywords

2011-03-08 Thread Matt Chaput
might want to investigate these resources and try google searches for e.g. "extracting key terms from documents" and then come back if you have a question about the Python implementation. Cheers, Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading/Writing files

2011-03-18 Thread Matt Chaput
ile.write("Hello world!\n") myfile.close() Beyond that, your message is too vague to offer any real help, but it sounds like you're way off track. If the above code doesn't help, please tell us exactly what you're trying to do, but you might want to read a Python book such as

tkSimpleDialog.Dialog.ok calls Cancel

2011-04-04 Thread Matt H
I am subclassing tkSimpleDialog.Dialog as a (sqlite) database front- end. This parent dialog opens a number of child dialogs to propagate sub-tables (like sub-forms in OOo). These subforms write their input into the database (INSERT...) The parent dialog then either commits or rolls-back transacti

Re: Tips on Speeding up Python Execution

2011-04-08 Thread Matt Chaput
On 08/04/2011 11:31 AM, Chris Angelico wrote: On Sat, Apr 9, 2011 at 12:41 AM, MRAB wrote: On 08/04/2011 08:25, Chris Angelico wrote: [snip] I don't know what's the most Pythonesque option, but if you already have specific Python code for each of your functions, it's probably going to be easi

Re: python on iPad (PyPad)

2011-04-09 Thread Matt Schinckel
pecific > capabilities if there is enough interest. > > Enjoy... > > Jon Dowdall I know this sound shallow, but you really need a nicer icon. Otherwise, I'm quite excited about this. It will certainly be better than my current workflow of connecting via ssh to a server just to run

Snowball to Python compiler

2011-04-21 Thread Matt Chaput
ly, a Snowball interpreter written in Python. (http://snowball.tartarus.org/) Anyone heard of such a thing? Thanks! Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Snowball to Python compiler

2011-04-21 Thread Matt Chaput
esn't seem like there is such a thing, but I figured I'd take a shot here before I think about doing it myself :/ Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert AWK regex to Python

2011-05-16 Thread Matt Berends
This doesn't directly bear upon the posted example, but I found the following tutorial extremely helpful for learning how to parse log files with idiomatic python. Maybe you'll might find it useful, too. http://www.dabeaz.com/generators/ http://www.dabeaz.com/generators/Generators.pdf -- http://

Re: People choosing Python 3

2017-09-11 Thread Matt Ruffalo
On 2017-09-10 05:42, Chris Warrick wrote: > > RHEL’s release process starts at forking a recent Fedora release. It > wouldn’t make much sense for them to undo the Python 3 progress that > happened over the past few years in Fedora — including dnf, an > improved package manager written in Python 3.

Re: Unicode

2017-09-17 Thread Matt Ruffalo
On 2017-09-17 17:27, leam hall wrote: > > Ah! So this works in Py2: >def __str__(self): > name= self.name.encode("utf-8") > > > It completely fails in Py3: > PVT b'Lakeisha F\xc3\xa1bi\xc3\xa1n' 7966A4 [F] Age: 22 > > > Note that moving __str__() to display() gets the same result

Re: Printing a Chunk Of Words

2017-09-27 Thread Matt Wheeler
,f)for r in(t,f)]+[(n,t),(n,f)]:x=' '.join(x);l+=[x[0].upper()+x[1:]+" is "+str(eval(x))] for i in 12,9,5,0:l.insert(i,'') print('\n'.join(l)) Reproducing the original string exactly the best I've managed is 260: t,f,a,o,n='True','False

Re: Printing a Chunk Of Words

2017-09-27 Thread Matt Wheeler
inal string. > I guess you didn't try it? (or see `upper()` in the body of the `for` below) > l=[" Boolean Operators\n"+"-"*24] > > for x in [(l,p,r)for p in(a,o)for l in(t,f)for r > in(t,f)]+[(n,t),(n,f)]:x=' > > '.join(x);l+=[x[0].upper()+x

Re: Printing a Chunk Of Words

2017-09-27 Thread Matt Wheeler
n) > I guess you still didn't run it ;D (see the 2nd `for` statement). I diffed my output against the original, which is why I'm confident in the correctness of my solution ;) Actually I managed to shave off another byte by changing `l.insert(i,'')` to `l[i:i]=['']`, so now I'm on 259. I should probably stop now... -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Vim, ctags jump to python standard library source

2017-10-19 Thread Matt Schepers
I prefer to use vim and ctags when developing python, but I'm having trouble getting ctags to index the standard library. Sometimes I would like to see an object's constructor etc... Does anyone know how to do this? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: import issues python3.4

2017-11-10 Thread Matt Wheeler
vailable in the local $PATH [0] https://tox.readthedocs.io/en/latest/ [1] http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Compile Python 3 interpreter to force 2-byte unicode

2017-11-29 Thread Matt Wheeler
ty of any other cross-platform incompatibilities playing a part? > -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Recommended pypi caching proxy?

2017-12-18 Thread Matt Wheeler
same functionality and all of which > are a few years old. > Recommendations from the crowd? > In the past I've used https://github.com/devpi/devpi It may have many features you don't need if all you're after is a caching proxy, but I found it does that well and it appear

Re: unabe to import /pyd file.

2017-12-25 Thread Matt Wheeler
botframework remote library [ https://github.com/robotframework/RemoteInterface] to run the Java-dependent parts in Jython & the CPython-dependent parts in CPython (I've not used the remote library myself so don't know how easy it is to work with, but it should work either way around)) * pip install robotframework > -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Matt Wheeler
27;t particularly helpful advice if you're sitting in any seat other than the driver's seat, however. -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

libxml2 installation/binding issue with Python 3.6.4

2018-02-05 Thread Priest, Matt
DEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes python3-config -ldflags; -L/nfs/sc/disks/slx_1353/mlpriest/sl1/work_root/a0/development/sfwr/lib/python3.6/config-3.6m-x86_64-linux-gnu -L/nfs/sc/disks/slx_1353/mlpriest/sl1/work_root/a0/development/sfwr/lib -lpython3.6m -lpthread -ldl -lutil -lr

RE: libxml2 installation/binding issue with Python 3.6.4

2018-02-06 Thread Priest, Matt
Dieter, I'm sure it's the Python version, I was hoping the "latest" set of the dependencies would get me there. I'll explore stepping that version back and let you know... Thank you, Matt -Original Message- From: Python-list [mailto:python-list-

Re: psutil

2018-02-27 Thread Matt Wheeler
path you have here this looks like you have a non standard python package for EL7 (in addition to the system one, or you'd be having a worse day), which is probably the root of your problem. Are you using python packages from scl perhaps? If so you probably need to install python27-pytho

Re: argparse — adding a --version flag in the face of positional args

2022-11-27 Thread Matt Wheeler
able to tell argparse I'm going to process --verbose, then > exit? > > Thx, > > Skip > -- > https://mail.python.org/mailman/listinfo/python-list -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

[ANN] PyYAML-5.4b1: Linux and Mac users, please test wheels!

2021-01-14 Thread Matt Davis
dump(_)) name: PyYAML homepage: https://github.com/yaml/pyyaml description: YAML parser and emitter for Python keywords: [YAML, serialization, configuration, persistence, pickle] Maintainers === The following people are currently responsible for maintaining PyYAML: * Ingy döt Net * Matt

[ANN] PyYAML-5.4 Released

2021-01-19 Thread Matt Davis
aml', 'description': 'YAML parser and emitter for Python', 'name': 'PyYAML'} >>> print(yaml.dump(_)) name: PyYAML homepage: https://github.com/yaml/pyyaml description: YAML parser and emitter for Python keywords: [YAML, serialization, configur

[ANN] PyYAML-5.4.1 Released

2021-01-20 Thread Matt Davis
emitter for Python', 'name': 'PyYAML'} >>> print(yaml.dump(_)) name: PyYAML homepage: https://github.com/yaml/pyyaml description: YAML parser and emitter for Python keywords: [YAML, serialization, configuration, persistence, pickle] ``` Maintainers ==

Re: Code Formatter Questions

2021-03-29 Thread Matt Wheeler
> On 29 Mar 2021, at 04:45, Cameron Simpson wrote: > > yapf has many tunings. Worth a look. It is my preferred formatter. By > comparison, black is both opinionated and has basicly no tuning, > something I greatly dislike. This is not a mark or a vote against yapf (I’ve never used it), but I

Re: Not found in the documentation

2021-04-29 Thread Matt Wheeler
4, 5, 6, 7, 8, 9] ``` range objects are iterables, not iterators. We can see the consuming behaviour I think you are referring to by calling iter(): ``` >>> i = iter(r) >>> next(i) 0 >>> list(i) [1, 2, 3, 4, 5, 6, 7, 8, 9] ``` -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: PSA: Debian Stretch, apt-listchanges, and Python 3

2016-08-29 Thread Matt Wheeler
I think the real PSA is "don't mess with the system python(3) version". On Mon, 29 Aug 2016 at 13:18 Chris Angelico wrote: > If, like me, you build Python 3.6 from source and make it your default > 'python3' binary, you may run into issues with the latest > apt-listchanges, which has switched to

Re: PSA: Debian Stretch, apt-listchanges, and Python 3

2016-08-29 Thread Matt Ruffalo
On 2016-08-29 23:56, Chris Angelico wrote: > Up until very recently, the system Python has only been the Python 2. > (For a while, it wasn't even 2.7, but I could easily use altinstall > for that.) I have deliberately wanted to use 3.6 for ALL testing, not > just by messing with venvs or shell alia

Re: *args and **kwargs

2016-09-04 Thread Matt Ruffalo
On 2016-09-02 15:44, Ben Finney wrote: > Note that this has nothing to do with how the function is defined; in > the definition of the function, parameters are neither positional nor > keyword. You name each of them, and you define an order for them; and > neither of those makes any of them “positi

Re: how to automate java application in window using python

2016-09-18 Thread Matt Wheeler
On Thu, 15 Sep 2016, 08:12 meInvent bbird, wrote: > how to automate java application in window using python > > 1. scroll up or down of scroll bar > 2. click button > 3. type text in textbox > I would recommend having a look at pywinauto https://github.com/pywinauto/pywinauto It presents a very

Re: how to automate java application in window using python

2016-09-20 Thread Matt Wheeler
On Tue, 20 Sep 2016, 02:47 meInvent bbird, wrote: > can it contorl Maplesoft's maple which is a java executable file? > I don't know maple so I can't answer that. Which programming language an application is written in isn't really relevant for pywinauto, it's the graphical toolkit in use which

Re: Can this be easily done in Python?

2016-09-28 Thread Matt Wheeler
On Tue, 27 Sep 2016 at 20:58 TUA wrote: > Is the following possible in Python? > > Given how the line below works > > TransactionTerms = 'TransactionTerms' > > > have something like > > TransactionTerms = > > that sets the variable TransactionTerms to its own name as string > representation with

Re: Function to take the minimum of 3 numbers

2016-10-09 Thread Matt Wheeler
nsistent operators is not required but is easier to read and less > confusing. > Unfortunately in this case it's also less correct > -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: correct way to catch exception with Python 'with' statement

2016-11-29 Thread Matt Wheeler
On Tue, 29 Nov 2016 at 23:59 wrote: > If you want to do something only if the file exists (or does not), use > os.path.isfile(filename) > This opens you up to a potential race condition (and has potential security implications, depending on the application), as you're using LBYL[0]. If you want

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-16 Thread Matt Wheeler
s? So... Not for me, but obviously with the caveats above. Giving it a try in an Apple store is definitely a good idea :) -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: just started

2016-12-19 Thread Matt Wheeler
ip3.5 and the command python3.5 -m pip > install automatically translates into pip3.5 ? > Actually it's the other way around. The `pip3.5` (and `pip3`) commands both map to (effectively) `python3.5 -m pip`. You can see this if you run `cat $(which pip3)`. -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-02 Thread Matt Wheeler
i if your computer is fast enough (it's a bit of a resource hog), and syntastic as a great way to integrate style checkers & linters into vim. -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-03 Thread Matt Wheeler
. range() is not part of the for syntax at all, it's completely separate, it simply returns an iterator which the for loop can use, like any other. -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-03 Thread Matt Wheeler
On Tue, 3 Jan 2017 at 21:46 Matt Wheeler wrote: > range() is not part of the for syntax at all, it's completely separate, it > simply returns an iterator which the for loop can use, like any other. > *iterable -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/ma

Re: Screwing Up looping in Generator

2017-01-05 Thread Matt Wheeler
to do. range() is not part of the for syntax at all, it's completely separate, it simply returns an iterator which the for loop can use, like any other. -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-05 Thread Matt Wheeler
On Tue, 3 Jan 2017 at 21:46 Matt Wheeler wrote: > range() is not part of the for syntax at all, it's completely separate, it > simply returns an iterator which the for loop can use, like any other. > *iterable -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/ma

Re: PEP 393 vs UTF-8 Everywhere

2017-01-21 Thread Matt Ruffalo
On 2017-01-21 10:50, Pete Forman wrote: > Thanks for a very thorough reply, most useful. I'm going to pick you up > on the above, though. > > Surrogates only exist in UTF-16. They are expressly forbidden in UTF-8 > and UTF-32. The rules for UTF-8 were tightened up in Unicode 4 and RFC > 3629 (2003)

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-14 Thread Matt Ruffalo
On 2018-05-14 07:05, zljubi...@gmail.com wrote: > Hi, > > I have dataframe with CRM_assetID column as category dtype: > > df.info() > > > RangeIndex: 1435952 entries, 0 to 1435951 > Data columns (total 75 columns): > startTime1435952 non-null object > CRM_assetID

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-15 Thread Matt Ruffalo
On 2018-05-15 06:23, Zoran Ljubišić wrote: > Matt, > > thanks for the info about pydata mailing group. I didn't know it exists. > Because comp.lang.python is not appropriate group for this question, I > will continue our conversation on gmail. > > I have put len(

Re: virtualenv and ubuntu

2018-08-28 Thread Matt Ruffalo
On 2018-08-28 07:26, stone.zh...@gmail.com wrote: > Hi there, > > Sorry if the question is naive, I am on Ubuntu 16.04 with Python 3.5.2, now I > want to use virtualenv, I noticed there are two ways to get virtualenv > installed: > > 1) do "sudo apt-get install virtualenv" > 2) do "pip3 install v

Re: sum accuracy

2016-04-15 Thread Matt Wheeler
ect > > exact_sum([0.3, 0.7]) > > to be 1. and make def not_exact_but_probably_the_sum_you_wanted(nums): return sum(map(lambda x:Fraction(x).limit_denominator(), nums)) -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Matt Ruffalo
Hi- That seems like a reasonable approach, though I think there *really* needs to be an option along the lines of "subscribed to the list for the purposes of moderation, but not receiving list messages via email". I think I did this with the Git mailing list in the past, and it was quite useful. I

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Matt Wheeler
r something') class Queen(Piece): def validate_move(self, new): return any((test(self.position, new) for test in (move_straight, move_diag))) Ok I'll stop before I get too carried away... This is completely untested so bugs will abound I'm sure :) -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on List processing

2016-04-25 Thread Matt Wheeler
On Mon, 25 Apr 2016 15:56 , wrote: > Dear Group, > > I have a list of tuples, as follows, > > list1=[u"('koteeswaram/BHPERSN engaged/NA himself/NA in/NA various/NA > philanthropic/NA activities/NA ','class1')", u"('koteeswaram/BHPERSN is/NA > a/NA very/NA nice/NA person/NA ','class1')", u"('kot

Re: re.search - Pattern matching review

2016-05-29 Thread Matt Wheeler
eturn block else: logging.info("block not found") >return False > logging.info("block not found") > return block And you probably don't need to explicitly return false, python functions implicitly return None (which is falsey) if they don't reach a return statement, but that's perhaps a matter of taste. -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list

Re: re.search - Pattern matching review

2016-05-30 Thread Matt Wheeler
On 30 May 2016 at 10:03, Ganesh Pal wrote: > Thanks Matt for the reply and lovely analysis . I was trying to complicate > the simple task :( > > Here is how the code looks now , the whole idea was just to match the > pattern and return it > > > def get_b

Re: Don't understand a probleme of module time not defined when calling a foo func

2016-05-30 Thread Matt Wheeler
On Mon, 30 May 2016, 21:08 Ni Va, wrote: > > _ > Output: > Traceback (most recent call last): > File "", line 1, in > File "", line 16, in PyExecReplace > File "", line 22, in > File "", line 11, in foo > NameError: global name 'time' is not defined > Based on your tracebac

Re: I'm wrong or Will we fix the ducks limp?

2016-06-03 Thread Matt Wheeler
Hi, On Fri, 3 Jun 2016, 16:04 Sayth Renshaw, wrote: > > So at the point I create the variable it refers to an object. > It's best to think of them as names, rather than variables, as names in python don't behave quite how you'll expect variables to if you're coming from some other languages. M

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Matt Wheeler
First of all welcome :) The other suggestions you've received so far are good so I won't repeat them... (note that in particular I've reused the names you've chosen in your program where I've given code examples, but that's purely for clarity and I agree with the others who've said you should use

Re: Re - Contradictory error messages in Python 3.4 - standard library issue!

2016-06-16 Thread Matt Wheeler
On Thu, 16 Jun 2016, 23:31 Harrison Chudleigh, < harrison.chudlei...@education.nsw.gov.au> wrote: > Sorry! I was trying to indent a line and accidentally sent only half of the > message. > It would be helpful if your reply was actually a reply to your previous message, to enable us to follow the

Re: Running yum/apt-get from a virtualenv

2016-07-04 Thread Matt Wheeler
On Fri, 24 Jun 2016, 03:32 Tiglath Suriol, wrote: > Let us say that I install PostgreSQL from an activated virtualenv using > yum or apt-get, will PostgrSQL be local or global? > Global I understand that virtualenv isolates the Python environment only, so I > surmise that it will make no differ

Re: functools.partial [was Re: and on - topic and and off topic]

2016-07-29 Thread Matt Wheeler
On Fri, 29 Jul 2016, 09:20 Steven D'Aprano, wrote: > I'm not sure that partial is intended as an optimization. It may end up > saving time by avoiding evaluating arguments, but that's not why it exists. > It exists to enable the functional programming idiom of partial evaluation > in a simpler, m

Re: Win32 API in pywin32

2016-08-05 Thread Matt Wheeler
On Fri, 5 Aug 2016, 02:23 Lawrence D’Oliveiro, wrote: > On Friday, August 5, 2016 at 12:06:23 PM UTC+12, Igor Korot wrote: > > > > On Thu, Aug 4, 2016 at 4:57 PM, Lawrence D’Oliveiro wrote: > >> On Friday, August 5, 2016 at 11:50:28 AM UTC+12, jj0ge...@gmail.com > wrote: > >>> According to Python

<    1   2   3   4   5   6   7   8   >