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
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
> 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
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
==
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
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
On 29 Dec 2020, 14:48 +, Chris Green , wrote:
> I seem to have quite a lot of old python packages installed over the
> years using pip and would like, if I can. to clear some of them out.
>
>
> Is there any way to tell if a python package was installed by me
> directly using pip or was installe
On 15/12/20 15:26, Grant Edwards wrote:
> On 2020-12-15, Mark Polesky via Python-list wrote:
>
>> I see. Perhaps counterintuitive,
> I guess that depends on what programming language you normally think
> in. Python's handling of function parameters is exactly what I
> expected, because all of the
for item in self.data:
if all(item[k] == v for k,v in kwargs.items()):
return item
Or
return [item for item in self.data if all(item[k] == v for k,v in
kwargs.items())]
to return all matches
Beware though that either of these will be slow if your list of dicts is large.
If the list
On Tue, 11 Aug 2020, 02:20 Ganesh Pal, wrote:
> The possible value of stat['server2'] can be either (a)
> "'/fileno_100.txt'" or (b) '/fileno_100.txt' .
>
> How do I check if it the value was (a) i.e string started and ended
> with a quote , so that I can use ast.literal_eval()
>
BAFP
>
def ma
t; >>> from collections import defaultdict
> >>> d = defaultdict(list)
> >>> d["x"]
> []
> >>> d.default_factory = None
> >>> d["y"]
> Traceback (most recent call last):
> File "", line 1, in
> KeyE
> Not quite.
>
> 1. Create a list of threads.
>
> 2. Put the items into a _queue_, not a list.
>
> 3. Start the threads.
>
> 4. Iterate over the list of threads, using .join() on each.
>
> If you're going to start the threads before you've put all of the items
> into the queue, you can also put a
"Creating Threads..."
port = 80
for i in range(1, 10):
t = threading.Thread(target=start_test)
t.start()
print "Waiting on Threads..."
t.join()
print "Finished..."
On Fri, Jan 24, 2020 at 2:44 PM Chris Angelico wrote:
>
> On Sat, Jan 25, 2020 at 7:3
thread safe?
On Fri, Jan 24, 2020 at 2:44 PM Chris Angelico wrote:
>
> On Sat, Jan 25, 2020 at 7:35 AM Matt wrote:
> >
> > I am using this example for threading in Python:
> >
> > from threading import Thread
> >
> > def start_test( address, port ):
&
I am using this example for threading in Python:
from threading import Thread
def start_test( address, port ):
print address, port
sleep(1)
for line in big_list:
t = Thread(target=start_test, args=(line, 80))
t.start()
But say big_list has thousands of items and I only want to h
On Tue, 22 Oct 2019, 09:44 joseph pareti, wrote:
> the following code ends in an exception:
>
> import re
> pattern = 'Sottoscrizione unica soluzione'
> mylines = []# Declare an empty list.
with open ('tmp.txt', 'rt') as myfile: # Open tmp.txt for reading tex
Thanks Reto. I got it now. Matt
On Sun, Jul 14, 2019 at 2:26 PM Reto wrote:
> On Sun, Jul 14, 2019 at 12:20:56PM -0400, Matt Zand wrote:
> > Given a string, return a new string where the first and last chars have
> > been exchanged.
>
> This sounds awfully like a homework
I am new to Python. I am trying to solve below Python question:
Given a string, return a new string where the first and last chars have
been exchanged.
--
Cheers,
Matt Zand
Cell: 202-420-9192
Work: 240-200-6131
High School Technology Services <https://myhsts.org/>
DC Web Makers
o according
to git blame. In tarfile.py, the version string was last changed 12
years ago. But in both, the modules were edited in 2018 so they haven't
been static for a decade.
Are those strings there just for historic purposes?
Not a big deal, I was just wondering.
Thanks,
Matt
--
Matt Tho
> On 16 Nov 2018, at 14:54, Steve Keller wrote:
> More elegant are generator expressions but I cannot think of a way
> without giving an upper limit:
>
>for i in (2 ** i for i in range(100)):
>...
>
> which looks ugly. Also, the double for-loop (and also the two loops
> in the
ntextmanager
def pushd(path):
old_dir = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(old_dir)
```
(I tend to just copy this into projects where I need it (or write it again), as
a whole dependency for something so tiny seems like it would be overk
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
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(
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
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
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-
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
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
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
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
ty of any other cross-platform incompatibilities playing a part?
> --
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
,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
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
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.
window-manager level automation tool (and will also solve the focus problem
for you).
[0] https://github.com/pywinauto/pywinauto
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
nk you.)
>
> [x + 1 for x in (0, 1, 2, 999, 3, 4) if x < 5]
>
[1, 2, 3, 4, 5]
> How about these?
>
> [x + y for x in (0, 1, 2, 999, 3, 4) while x < 5 for y in (100, 200)]
>
[100, 200, 101, 201, 102, 202]
> [x + y for x in (0, 1, 2, 999, 3, 4) if x < 5 for y i
tions-abstract-base-classes
All of the mixin methods (the ones defined for you) will call the abstract
methods you override.
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 1 Aug 2017 at 12:53 Thomas Nyberg wrote:
> On 08/01/2017 01:06 PM, Matt Wheeler wrote:
> > A function which is moderately expensive to run, that will always return
> > the same result if run again in the same process, and which will not be
> > needed in every sessio
un, maintaining the interface would trump
simplicity for the simple case).
I've not investigated the Django codebase, so I don't know if my guesses
line up with it exactly, but it should be quite easy to construct a grep or
sed script to scan the source to find out :)
--
--
Matt Wheeler
aps it should also be listed at
https://docs.python.org/3.6/genindex-Symbols.html
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
uld be
more appropriate)
> --
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
your intention has been mangled somewhere along
the way, and in any case the code seems to be missing parts.
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
{"warehouseCode":"AB-1-CA","quantityAvailable":1.0},{"warehouseCode":"WA-1-US","quantityAvailable":0.0},{"warehouseCode":"PO-1-CA","quantityAvailable":0.00000}]}]
>>> json.loads(s)
[{u
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
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
ively, without using inspect, we can get around `Object.__module__`
being a string by importing it as a string:
>>> import importlib, os
>>> importlib.import_module(os.path.split.__module__).__file__
'/Users/matt/.pyenv/versions/3.6.0/lib/python3.6/posixpath.py'
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
og the arguments passed to the functions (you didn't
say that) things get a bit more complex, but it's still certainly
achievable.
If you actually need to wrap the class in place for testing you might look
into combining something like the above with the mock library.
--
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
On 2017-05-03 12:43, Thomas Nyberg wrote:
> On 05/03/2017 11:47 AM, Wolfgang Maier wrote:
>> On 03.05.2017 17:11, Thomas Nyberg wrote:
>>> On 05/03/2017 11:04 AM, Daiyue Weng wrote:
nope, I was thinking it might be good to update to 3.5.3 for security
reasons?
>>> (CCing back in pyth
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
Does anyone have an example of using netsnmp library to do a snmpset
on a snmp v2 device? I have gotten snmpget to work fine with python I
just cannot get snmpset to work. I know I have the snmp device
configured correctly with read/write access since I can use snmpset on
the linux(centos7) comma
What is easiest way to read and write SNMP values with Python?
--
https://mail.python.org/mailman/listinfo/python-list
A small correction...
On Mon, 13 Mar 2017 at 22:36 Matt Wheeler wrote:
> ```
> from unittest.mock import patch
>
> import lorem
>
>
> @patch('lorem.type')
> def test_things(mocktype):
> lorem.quux(metameta.Foo())
>
> lorem.return_value.assert
'Foo', unittest.mock.ANY, unittest.mock.ANY)
>
When I try to add the stub_metaclass side_effect in to my code I get
`TypeError: __new__() missing 2 required positional arguments: 'bases' and
'namespace'` ... which seems quite reasonable, an
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)
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
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
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
.
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
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
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
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
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
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
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
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
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
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
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
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
On 2016-08-04 15:45, Random832 wrote:
> On Thu, Aug 4, 2016, at 15:22, Malcolm Greene wrote:
>> Hi Chris,
>>
>> Thanks for your suggestions. I would like to capture the specific bad
>> codes *before* they get replaced. So if a line of text has 10 bad codes
>> (each one raising UnicodeError), I woul
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
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
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
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
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
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
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
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
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
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
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
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
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
L[i]=0
That doesn't clear the list, that results in a list of the same length
where every element is 0. That might sound like the same thing if
you're used to a bounded array of ints, for example, but in Python
it's very much not.
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote:
> On 24.03.2016 11:57, Matt Wheeler wrote:
> >>>> import ast
> >>>> s = "(1, 2, 3, 4)"
> >>>> t = ast.literal_eval(s)
> >>>> t
> > (1, 2, 3, 4)
>
> I suppose
o recover the tuple in a variable t
>
> t = (1, 2, 3, 4)
>
> how would you do ?
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
On 20 March 2016 at 16:46, Sven R. Kunze wrote:
> On 19.03.2016 00:58, Matt Wheeler wrote:
>>
>> I know you have a working solution now with updating the code &
>> defaults of the function, but what about just injecting your function
>> into the modules that ha
Hi all-
I'm writing a backup client for automating the synchronization of btrfs
snapshots between machines -- essentially piping the output of `btrfs
send` on my laptop/desktop to `btrfs receive` on a server. I've been
doing this manually for quite a while, and something automated would be
much mo
, prefix=None,
> current_app=None):
>
>
> Some ideas?
I know you have a working solution now with updating the code &
defaults of the function, but what about just injecting your function
into the modules that had already imported it after the
monkeypatching?
Seems perhaps cleaner
On 10 March 2016 at 18:12, wrote:
> Matt, thank you for if...else suggestion, the data of NewTotalTag.txt
> is like a simple list of words with unconventional tags, like,
>
> w1 tag1
> w2 tag2
> w3 tag3
> ...
> ...
> w3 tag3
>
> like that.
I suspected so. The
On 9 March 2016 at 12:06, Matt Wheeler wrote:
> But we can still do better. A list is a poor choice for this kind of
> lookup, as Python has no way to find elements other than by checking
> them one after another. (given (one of the) name(s) you've given it
> sounds a bit li
ld definitely still do that
too!), especially if your word list is very large.
This is because the set type uses a hashmap internally, making lookups
for matches extremely fast, compared to scanning through the list.
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
s is wordier and more fragile than using a context manager
to clean up for you, I expect you won't bother :).
[1] https://docs.python.org/2/library/contextlib.html#contextlib.closing
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
m sure there was a recent thread about returning the best fit type
(i.e. int, if not then float, if not then str)?
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 18 Feb 2016 11:07 Chris Angelico wrote:
> By the way... For bash users, adding this to .bashrc may make venvs a
> bit easier to keep straight:
>
> checkdir() {
> [ -n "$VIRTUAL_ENV" ] && ! [[ `pwd` =~ `dirname $VIRTUAL_ENV`* ]]
> && echo Deactivating venv $VIRTUAL_ENV... && deactivate
pfile.NamedTemporaryFile with your newly created temp dir and an
arbitrary suffix, and strip the suffix off to get the name you actually
use.)
--
Matt Wheeler
http://funkyh.at
--
https://mail.python.org/mailman/listinfo/python-list
1 - 100 of 747 matches
Mail list logo