Jonathan Leroy - Inikup via Python-list wrote:
> Hi all,
>
> I'm writing a client library for a REST API. The API endpoints looks like
> this: /customers
> /customers/1
> /customers/1/update
> /customers/1/delete
>
> Which of the following syntax do you expect an API client library to
> use, and
Thomas Jollans wrote:
> On 29/04/2019 09.18, Peter Otten wrote:
>> Jonathan Leroy - Inikup via Python-list wrote:
>>
>>> Hi all,
>>>
>>> I'm writing a client library for a REST API. The API endpoints looks
>>> like this: /customers
>>
sinbad.sin...@gmail.com wrote:
> Below i was expecting the test() function to be called, but it doesn't. Am
> i doing it wrong? By the way i'm running version 2.7.10 on a mac.
>
> $python
>
import readline
def test():
> ... print("test")
> ...
test()
> test
print(help(readl
DL Neil wrote:
> On 21/05/19 8:40 PM, Paul Moore wrote:
>> On Tue, 21 May 2019 at 09:25, Frank Millman wrote:
>>>
>>> On 2019-05-21 9:42 AM, Madhavan Bomidi wrote:
Hi,
I need to create an array as below:
tempStr =
year+','+mon+','+day+','+str("{:6.4f}".format(UTCHrs[
Rich Shepard wrote:
> Running python3-3.7.3 on Slackware-14.2.
>
> I'm trying to debug a module using pdb but failing with all attempts. For
> example, using breakpoint() at the line where I want to stop the running
> module and examine each line's execution, the program runs to completion
> and
On Wed, 12 Jun 2019 04:12:34 -0700 (PDT), Rishika Sen wrote:
> So I am coding in Python. I have to set of samples. Set1 contains
> samples of class A and the other set, Set2 contains samples of class
> B. When I am predicting set1 and set2 individually, the classification
> is perfect. Now when I
Machiel Kolstein wrote:
>
> Hi,
>
> I get the following error:
>
> ERROR:
> Traceback (most recent call last):
> File "exponential_distr.py", line 32, in
> numpy.histogram(data_array, bins=100, range=2)
> File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line
>
On 22 Jun 2019 13:24:38 GMT, Stefan Ram wrote:
[snip]
>
> print( next( ( pair for pair in pairs if pair[ 0 ]== 'sun' ),
> ( 0, '(unbekannt)' ))[ 1 ])
> print( next( itertools.dropwhile( lambda pair: pair[ 0 ]!= 'sun', pairs ))
> [ 1 ])
[snip]
>
> The last two lines of
Sayth Renshaw wrote:
> Afternoon
>
> Trying to create a generator to write the first N lines of text to a file.
> However, I keep receiving the islice object not the text, why?
>
> from itertools import islice
>
> fileName = dir / "7oldsamr.txt"
> dumpName = dir / "dump.txt"
>
> def getWord(in
[snip]
> print( dict( pairs ).get( 'sun', '(unknown)' ))
You probably know this, but . . . just in case . . .
If you're doing this many times, you'll want to construct the dict
just once and then make many references to the dict, rather than
re-constructing the dict every time you want to look up
Sayth Renshaw wrote:
> Hi
>
> Having fun with pandas filtering a work excel file.
> My current script opens selected and filters the data and saves as excel.
>
> import pandas as pd
> import numpy as np
>
> log = pd.read_excel("log_dump_py.xlsx")
> df = log.filter(items=['Completed', 'Priority'
Sayth Renshaw wrote:
> Peter Otten wrote:
>> def explode_consultants(consultants):
Should have called that split_consultants(); takes a string and
>> consultants = (c.lstrip("#") for c in consultants.split(";"))
splits by ";", remov
it possible to
>create a Windows executable on a Linux system?
>Any pointers about best practice creating a standalone executable are
>welcome.
Is using a portable Python installation an option?
--
Dipl.-Inform(FH) Peter Heitzer, peter.heit...@rz.uni-regensburg.de
--
https://mail.python
On Thu, 11 Jul 2019 06:54:21 +0100, Debasree Banerjee wrote:
>
> I have a dataset like this:
>
> RecTime
>
> NO2_RAW
>
> NO2
>
> LAQN_NO2
>
> 10980
>
> 06/6/19 01:45
>
> 17.9544
[snip]
>
> Can someone please help?
Your question might appear intelligibly on the mailing list (I can't tell),
but
Madhavan Bomidi wrote:
> I am using the following command line to sort the files:
>
> import glob
> a = sorted(glob.glob('3RIMG_*.h5')
>
> Following is the result:
>
> 3RIMG_01APR2018_0514_L2G_AOD.h5
> 3RIMG_01APR2018_0544_L2G_AOD.h5
> 3RIMG_01APR2018_0644_L2G_AOD.h5
> 3RIMG_01APR2018_0714_L2G_
On Mon, 15 Jul 2019 09:20:51 +0200, Peter Otten <__pete...@web.de> wrote:
> Madhavan Bomidi wrote:
>
[snip]
>>
>> 3RIMG_01APR2018_0514_L2G_AOD.h5
>> 3RIMG_01APR2018_0544_L2G_AOD.h5
>> 3RIMG_01APR2018_0644_L2G_AOD.h5
>> 3RIMG_01APR2018_0714_L2G_AOD.h
On Mon, 22 Jul 2019 16:25:32 -0500, Michael F. Stemper wrote:
> On 22/07/2019 15.58, Chris Angelico wrote:
>> On Tue, Jul 23, 2019 at 6:34 AM Michael F. Stemper
>> wrote:
>>>
[snip]
>>> from datetime import datetime
>>> from time import strftime
>>> timestamp = datetime.now().strftime( "%Y-%
Chris Angelico wrote:
> When talking about indistinguishable objects, is it correct to talk
> about "the " or "an "?
>
> Example:
>
> def f(s):
> """Frob a thing.
>
> If s is an empty string, frobs all the things.
> OR
> If s is the empty string, frobs all the things.
> """
Paul St George wrote:
> I am using Python 3.5 within Blender. I want to collect values of the
> current settings and then write all the results to a file.
>
> I can see the settings and the values in the Python console by doing
> this for each of the settings
> |
> |
>
> |print(“Focal length:”,b
Larry Martell wrote:
> I have some code that is using the pyke package
> (https://sourceforge.net/projects/pyke/). That project seems fairly
> dead, so asking here.
>
> There is a pyke function that returns a context manager with an
> iterable map. In py2.7 I did this:
>
> from pyke import knowl
Larry Martell wrote:
>> Pyke has been ported to py3. Here is the code that returns the data I
>> am trying to process:
>>
>> return map(self.doctor_answer, it)
>>
>> I don't see anything calling imap.
>
> I grepped through the entire pyke code and imap is not in there.
Fire up the python3 interp
Paul St George wrote:
> In the code (below) I want a new line like this:
>
> Plane rotation X: 0.0
> Plane rotation Y: 0.0
> Plane rotation Z: 0.0
>
> But not like this:
>
> Plane rotation X:
> 0.0
> Plane rotation Y:
> 0.0
> Plane rotation Z:
> 0.0
>
> Is it possible?
> print(
>
> "Plane ro
Youssef Abdelmohsen wrote:
> Note: Beginner
>
> I'm trying to create an html parser that will go through a folder and all
> its subfolders and export all html files without any html tags, in file
> formats CSV and TXT with each html labeled with the title of the web page
> in a new CSV and TXT.
>
Chris Angelico wrote:
> On Thu, Aug 15, 2019 at 7:41 PM Gregory Ewing
> wrote:
>>
>> Chris Angelico wrote:
>> > I prefer to say "Trails" for the table, and "Trail" would then refer
>> > to a single row from that table.
>>
>> That makes sense for a data structure in your program that contains a
>>
Paul St George wrote:
> Can someone please tell me how to get the absolute path to a file? I
> have tried os.path.abspath. In the code below I have a problem in the
> final line (15).
>
> #
> |import bpy||
Is this blender? If so the "//" prefix starts making sense:
https://docs.blender.org/api/
On Sat, 17 Aug 2019 10:58:43 -0700 (PDT), Amirreza Heidari wrote:
> plt.figure(1)
> plt.plot(history.history["loss"], "b", label="Mean Square Error of training")
> plt.plot(history.history["val_loss"], "g", label="Mean Square Error [snip]
> plt.legend()
> plt.xlabel("Epoche")
> plt.ylabel("Mean Squ
Sayth Renshaw wrote:
> def output_data(s):
> serie = fibo(input_length)
> x = []
> y = []
>
> for num1, num2 in pairwise(serie):
> y.append( num2 / num1)
It looks like y contains unique values. In that case replace
> for item in y:
> x.append(y.index(item
Sayth Renshaw wrote:
> On Thursday, 29 August 2019 14:03:44 UTC+10, Sayth Renshaw wrote:
>> On Thursday, 29 August 2019 13:53:43 UTC+10, Sayth Renshaw wrote:
>> > On Thursday, 29 August 2019 13:25:01 UTC+10, Sayth Renshaw wrote:
>> > > Hi
>> > >
>> > > Trying to find whats changed in this exam
Sayth Renshaw wrote:
> will find the added
> pairs, but ignore the removed ones. Is that what you want?
>
> Yes, I think. I want to find the changed pairs. The people that moved team
> numbers.
To find the people that moved team numbers I would tear the pairs apart.
Like:
>>> people = ["Tim","
Hongyi Zhao wrote:
> On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
>
>> I don't understand what's to not to understand.
>>
>>if condition:
>> do_something_because_condition_is_true()
>>else:
>> do_something_because_condition_is_false()
>>
>> is a perfectly normal con
Sayth Renshaw wrote:
> On Thursday, 29 August 2019 20:33:46 UTC+10, Peter Otten wrote:
>> Sayth Renshaw wrote:
>>
>> > will find the added
>> > pairs, but ignore the removed ones. Is that what you want?
>> >
>> > Yes, I think. I want to find
Manfred Lotz wrote:
> Hi there,
> This is a beginner question.
>
> I learned that
>
> with open("foo.txt") as f:
> lines = f.readlines()
>
> using the with-construct is the recommended way to deal with files
> making sure that close() always happens.
>
> However, I also could do:
>
>
feedback on any
aspect of the code. Not only correctness, but things like if I'm
handling cancellation correctly or is the a more idiomatic way to go
back this?
Thanks,
Peter.
```
from __future__ import annotations
import asyncio
import time
from contextlib import asynccontextmanage
Eko palypse wrote:
> I've already sent this through mail yesterday but it doesn't appear here,
> maybe because of the help word in the content. Please execute in case it
> appears a second time.
>
>
> Hello,
> I'm creating a notepad++ plugin which hosts an embedded python interpreter
> by using
Israel Brewster wrote:
> When using pool.imap to apply a function over a list of values, what is
> the proper way to pass additional arguments to the function, specifically
> in my case a Queue that the process can use to communicate back to the
> main thread (for the purpose of reporting progress
Antoon Pardon wrote:
> What I am trying to do is the following.
>
> class MyClass (...) :
> @register
> def MyFunction(...)
> ...
>
> What I would want is for the register decorator to somehow create/mutate
> class variable(s) of MyClass.
>
> Is that possible or do I have to ret
A S wrote:
> I understand that reading lines in .txt files would look something like
> this in Python:
>
>
> with open('filename','r') as fd:
>lines = fd.readlines()
>
>
> However, how do I run my code to only read the words in my .txt files that
> are within each balanced parenthesis?
>
Antoon Pardon wrote:
> On 4/09/19 17:46, Peter Otten wrote:
>> Antoon Pardon wrote:
>>
>>> What I am trying to do is the following.
>>>
>>> class MyClass (...) :
>>> @register
>>> def MyFunction(...)
>>> ...
>
Antoon Pardon wrote:
> On 5/09/19 15:30, Peter Otten wrote:
>> Can you provide some context?
>
> Sure I am researching the possibility of writing an easy to use
> lexing/parsing tool. The idea is to write your lexer/parser as
> follows:
>
> class Calculator(metaclass
Rob Gaddi wrote:
> I'm trying to figure out how to rename an import globally for an entire
> package.
> Something like:
>
> pkg/__init__.py:
> import graphing_module_b as graph
If you want to go low-level:
sys.modules["pkg.graph"] = graph
will make
> pkg/foobar.py:
> from .graph
jf...@ms4.hinet.net wrote:
> I had tried the following script test.py:
>
> import tkinter as tk
>
> class Demo(tk.Frame):
> def __init__(self):
> tk.Frame.__init__(self, name='demo')
> self.pack()
>
> panel = tk.Frame(self, name='panel')
> pan
Eko palypse wrote:
> I'm fairly new when it comes to metaclass programming and therefore the
> question whether the following makes sense or not.
>
> The goal is to have two additional class properties which return a
> dictionary name:class_attribute and value:class_attribute for an IntEnum
> cla
Hongyi Zhao wrote:
> What is the Difference Between quit() and exit() commands in Python?
They are instances of the same type
>>> import inspect
>>> type(quit) is type(exit)
True
>>> print(inspect.getsource(type(quit)))
class Quitter(object):
def __init__(self, name, eof):
self.name
ast wrote:
> Hello
>
> Following syntax doesn't generate any errors:
>
> >>> foo=0
> >>> Class Foo:
> foo
>
> But class Foo seems empty
>
> Is it equivalent to ?
>
> >>> class Foo:
> pass
The resulting class is equivalent, but the expression `foo` is actually
evaluated d
Manfred Lotz wrote:
> I have a function like follows
>
> def regex_from_filepat(fpat):
> rfpat = fpat.replace('.', '\\.') \
> .replace('%', '.') \
> .replace('*', '.*')
>
> return '^' + rfpat + '$'
>
>
> As I don't want to have the replace()
Manfred Lotz wrote:
>> Not related to your question, but:
>> You seem to try to convert a Windows wildcard pattern to a regex
>> pattern.
>
> No, I'm on Linux.
>
> Shortly, after I had posted the question I discovered fnmatch() in the
> standard library, and I changed my code accordingly.
I wou
Eko palypse wrote:
> exec('import test01', globals())
> print('f3 out', x)
>
> # result exception, expected but because f1 didn't throw an exception
> # I'm confused. module test01 has only this two lines
> x += 1
> print('f3 in:', x)
The lines above run in the test01's global namespace, not in
Manfred Lotz wrote:
>> Where does '%' come from?
>>
>
> '%' was a mistake as I had replied myself to my initial question.
Oh, sorry. I missed that.
--
https://mail.python.org/mailman/listinfo/python-list
Eko palypse wrote:
>> Then it should be clear that the name 'test01' is put into globals(), if
>> load_module() doesn't throw an exception. No sharing or nesting of
>> namespaces takes place.
>
> Thank you too for your answer. Ok, that means that in every case when exec
> imports something it has
Richard Damon wrote:
> On 9/19/19 6:16 AM, Eko palypse wrote:
>>> In all cases, if the optional parts are omitted, the code is executed in
>>> the current scope. ...
>>>
>>>
>>> You can see from it that "globals" is optional.
>>> And that, if "globals" is missing, then
>>> "exec" is executed in th
Eko palypse wrote:
> Thank you, I'm currently investigating importlib and read that
> __builtins__ might be another alternative.
> My ultimate goal would be to have objects available without the need to
> import them, regardless whether used in a script directly or used in an
> imported module.
I
Eko palypse wrote:
> No, I have to correct myself
>
> x = 5
> def f1():
> exec("x = x + 1; print('f1 in:', x)")
> return x
> print('f1 out', f1())
>
> results in the same, for me confusing, results.
>
> f1 in: 6
> f1 out 5
Inside a function exec assignments go to a *copy* of the local
Eko palypse wrote:
> Am Donnerstag, 19. September 2019 18:31:43 UTC+2 schrieb Peter Otten:
>> Eko palypse wrote:
>>
>> > No, I have to correct myself
>> >
>> > x = 5
>> > def f1():
>> > exec("x = x + 1; print('f1 in:
jf...@ms4.hinet.net wrote:
x = 3
def foo():
> ... exec("print(globals(), locals()); x = x + 1; print(globals(),
> locals())") ...
foo()
> {'foo': , '__package__': None, '__builtins__':
> {, '__loader__': {'_frozen_importlib.BuiltinImporter'>, '__doc__': None, '__name__':
> {'__
ast wrote:
> Hello
>
> In the following code found here:
> https://www.pythonsheets.com/notes/python-object.html
>
> __init__ is not invoked when we create an object
> with "o = ClassB("Hello")". I don't understand why.
> I know the correct way to define __new__ is to write
> "return object.__ne
Pradeep Patra wrote:
> Hi all,
>
> I have written a small program to generate all the combinations of a and b
> of the array. I want (6,7) tuple also included. Can anybody suggest what
> change I should make to get 6,7 included in my output? Any suggestions
The spec is not clear to me. If you do
On Fri, 27 Sep 2019 02:13:31 -0700 (PDT), Madhavan Bomidi wrote:
>
> Can someone help me to make python code (with some arbitrary data) for
> the angular distribution rose diagram as shown in figure 7 in the
> paper accessible through the web-link:
>
> https://www.nat-hazards-earth-syst-sci.net/17/
> Pradeep Patra wrote:
> My idea is to include the last element of array a and first element of
second array b in the final array.
fr.append((a[-1], b[0]))
--
https://mail.python.org/mailman/listinfo/python-list
Hongyi Zhao wrote:
> Hi,
>
> I have some code comes from python 2 like the following:
>
> str('a', encoding='utf-8')
This fails in Python 2
>>> str("a", encoding="utf-8")
Traceback (most recent call last):
File "", line 1, in
TypeError: str() takes at most 1 argument (2 given)
...unless yo
DL Neil via Python-list wrote:
> Should pathlib reflect changes it has made to the file-system?
>
>
> Sample code, below, shows pathlib identifying a data-file and then
> renaming it. Yet, after the rename operation, pathlib doesn't recognise
> its own change; whereas the file system does/proves
Barry Scott wrote:
> See https://pypi.org/project/colour-text/ for documentation
> with colourful examples.
>
> Install using pip:
>
> python -m pip install colour-text
Have you considered to spell that color-text?
In programming the guys who can't spell won ;)
--
https://mail.python.org/m
Jagga Soorma wrote:
> Thanks again Aldwin. This seems to work, guess it is the set that is
> flipping the numbers:
>
> x,y = (output.split())
The parens on the right are superfluous:
>>> a, b = "foo bar".split()
>>> a
'foo'
>>> b
'bar'
> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -
Friedrich Rentsch wrote:
> Hi all,
>
> Python 2.7. I habitually work interactively in an Idle window.
> Occasionally I correct code, reload and find that edits fail to load. I
> understand that reloading is not guaranteed to reload everything, but I
> don't understand the exact mechanism and woul
Friedrich Rentsch wrote:
>
>
> On 10/5/19 2:48 PM, Peter Otten wrote:
>> Friedrich Rentsch wrote:
>>
>>> Hi all,
>>>
>>> Python 2.7. I habitually work interactively in an Idle window.
>>> Occasionally I correct code, reload and find th
Chris Angelico wrote:
> I'm not sure what's going on here, and it's probably not actually
> enum-specific, but that's where I saw it.
>
> If you create a plain class and have an attribute with an annotation,
> you can see that:
>
class Foo:
> ... spam: "ham" = 1
> ...
Foo.__a
> Foo
Chris Angelico wrote:
>> Looks like everything starting with an underscore (except class, doc, and
>> module) is suppressed, probably to suppress some noise...
>>
>
> That's why dir() shows what it does, but tab completion seems to have
> some other source, as it's able to find a lot of other att
Piet van Oostrum wrote:
> Chris Angelico writes:
>
>> I'm not sure what's going on here, and it's probably not actually
>> enum-specific, but that's where I saw it.
>>
>> If you create a plain class and have an attribute with an annotation,
>> you can see that:
>>
> class Foo:
>> ... spa
Antoon Pardon wrote:
> I have some logging utilities so that when I write library code, I just
> use the following.
>
> from logutil import Logger
>
> log = Logger(__name__)
If logutil is under your control you can make log a callable object with a
tracing method:
[logutil.py]
class Logger:
On Tue, 15 Oct 2019 18:57:04 +0300, Damla Pehlivan wrote:
[snip]
> . . . I downloaded the python program, and I
> also downloaded Pycharm to use it. To be fair, I do not know what I am
> doing, but I made some progress last night and I was happy about it. Today
> when I came back from university
Steve White wrote:
> Hi Chris,
>
> Yes, I am aware of the hash of small integers. But I am not keying
> with small integers here: I am keying with id() values of class
> instances.
The id() values /are/ smallish integers though.
(I would guess that this is baked into the CPython source, but di
Steve White wrote:
> Hi Peter,
>
> Yes you are right. In fact, I shouldn't even have mentioned the
> hash() function... it came from a line of reasoning about what an
> implementation might do if very large integers were returned by
> __hash__(), and some remarks about t
Steve White wrote:
> On Sun, Oct 20, 2019 at 7:57 PM Peter Otten <__pete...@web.de> wrote:
>>
>> Steve White wrote:
>> >
>> > The point is, I don't think __eq__() is ever called in a situation as
>> > described in my post, yet the Python docum
Antoon Pardon wrote:
> On 22/10/19 12:02, Terry Reedy wrote:
>> On 10/22/2019 4:58 AM, Antoon Pardon wrote:
>>> Using python 3.5
>>>
>>> I have been experimenting with curried functions. A bit like in Haskell.
>>> So I can write the following function:
>>>
>>> def sum4(a, b, c, d):
>>> return a +
joseph pareti wrote:
> I am experimnenting with this (reproducer) code:
> pattern_eur= ['Total amount']
Make that
pattern_eur = 'Total amount'
>match_C = re.search(pattern_eur, element)
The first argument to re.search() should be a string, not a list of strings:
>>> import re
>>> re.
On Thu, 24 Oct 2019 16:06:21 +0800, Maggie Q Roth wrote:
[snip]
> Can you show me the correct way to programming with graphics?
>
> I want to take some action detection, for instance, recognize dancing etc.
That description of your goals is very vague. The more specific you
can be about what you
Pascal wrote:
> I have a small python (3.7.4) script that should open a log file and
> display its content but as you can see, an encoding error occurs :
>
> ---
>
> import fileinput
> import sys
> try:
> source = sys.argv[1:]
> except IndexError:
> source = None
> fo
ferzan saglam wrote:
> On Wednesday, October 30, 2019 at 2:19:32 PM UTC, Matheus Saraiva wrote:
>> rounds = 0
>> while rounds <= 10:
...
> Thanks, it Works superbly.
> To get the limit of 10 i wanted, i had to make a slight change:
> while rounds <= 9 .
That's the (in)famous "off by one"
Veek M wrote:
> I was reading pydoc io and - how do I decipher the indentation?
$ cat demo.py
class Base: pass
class Sub(Base): pass
class SubSub(Sub): pass
class Other: pass
class OtherSub(Other, Base): pass
$ pydoc3.7 demo | head -n13
Help on module demo:
NAME
demo
CLASSES
builtins.o
lampahome wrote:
> I make a class Wrapper inherited from dict and met problem when I want to
> pickle it.
>
> Is there anyway to make __getstate__ of Wrapper to output a normal
> dict?(Output a dict will help pickleing easily)
>
>
> === code ===
> import pickle
> class Wrapper(dict):
> def
Tim Chase wrote:
> Working with the dbm module (using it as a cache), I've gotten the
> following error at least twice now:
>
> HASH: Out of overflow pages. Increase page size
> Traceback (most recent call last):
> [snip]
> File ".py", line 83, in get_data
> db[key] = data
> _dbm.e
Ulrich Goebel wrote:
> Hi,
>
> I have to call commands from inside a python skript. These commands are
> in fact other python scripts. So I made
>
> os.system('\.Test.py')
>
> That works.
>
> Now I tried to use
>
> supprocess.call(['.\', 'test.py'])
Remember to use cut and paste fo
Tim Johnson wrote:
> Using linux ubuntu 16.04 with bash shell.
> Am retired python programmer, but not terribly current.
> I have moderate bash experience.
>
> When trying to install pgadmin4 via apt I get the following error
> traceback when pgadmin4 is invoked:
>
> Traceback (most recent call
Tim Johnson wrote:
>> OK. Now I have
>>
>> /usr/local/lib/python3.7/site-packages/Click-7.0.dist-info/
>>
>> which holds the following files:
>>
>> INSTALLER LICENSE.txt METADATA RECORD top_level.txt WHEEL
>>
>> I haven't a clue as to how to proceed! Never seen this before ...
Just leave it
A S wrote:
I think I've seen this question before ;)
> I am trying to extract all strings in nested parentheses (along with the
> parentheses itself) in my .txt file. Please see the sample .txt file that
> I have used in this example here:
> (https://drive.google.com/open?id=1UKc0ZgY9Fsz5O1rSeBCL
Veek M wrote:
> class Foo(object):
> @property
> def name(self):
> if hasattr(self, '_name'):
> print('Foo name', self._name)
> return self._name
> else:
> return 'default'
>
> @name.setter
> def name(self, value):
> prin
A S wrote:
> On Tuesday, 3 December 2019 01:01:25 UTC+8, Peter Otten wrote:
>> A S wrote:
>>
>> I think I've seen this question before ;)
>>
>> > I am trying to extract all strings in nested parentheses (along with
>> > the parentheses i
Veek M wrote:
> you've misunderstood my question
There were a lot of foobars bazzing in my head, but at least I tried ;)
> , let me try again:
>
> So this is a simple descriptor class and as you can see, dunder-set needs
> 3 args: the descriptor CONTAINER/Bar-instance is the first arg, then a
>
Bob van der Poel wrote:
> I have some files which came off the net with, I'm assuming, unicode
> characters in the names. I have a very short program which takes the
> filename and puts into an emacs buffer, and then lets me add information
> to that new file (it's a poor man's DB).
>
> Next, I c
Michael Torrie wrote:
> On 12/6/19 5:31 PM, DL Neil via Python-list wrote:
>> If you read the HTML data that the REPL has happily splattered all over
>> your terminal's screen (scroll back) (NB "soup" is easier to read than
>> is "content"!) you will observe that what you saw in your web-browser i
RobH wrote:
> When I run a python project with an oled display on a rasperry pi zero,
> it calls for the Minecraftia.ttf font. I have the said file in
> home/pi/.fonts/
>
> I get this error:
>
> pi@raspberrypi:~/Downloads $ python interdisplay.py
> Traceback (most recent call last):
>File "i
R.Wieser wrote:
> Hello all,
>
> Using Python3 I would like to import a specific class from another file
> (in the same folder), and have trouble doing so.
>
> "from file import function" works, but fails when I try to do the same
> with a class.
Are you sure? It should behave the same for any
Musbur wrote:
> Hello,
>
> I have a function with a long if/elif chain that sets a couple of
> variables according to a bunch of test expressions, similar to function
> branch1() below. I never liked that approach much because it is clumsy
> and repetetive, and pylint thinks so as well. I've come
Tim Daneliuk wrote:
> I ran across a kind of fun problem today that I wanted to run past you
> Gentle Geniuses (tm):
>
> - Imagine an environment in which there may be multiple instances of a
> given
> microservice written in Python.
>
> - Each of these services needs to produce a string of te
On Mon, 9 Dec 2019 21:38:43 -0600, Tim Daneliuk wrote:
> On 12/9/19 8:54 PM, Dennis Lee Bieber wrote:
>> On Mon, 9 Dec 2019 18:52:11 -0600, Tim Daneliuk
>> declaimed the following:
>>
>>> - Each of these services needs to produce a string of ten digits
>>> guaranteed to be unique on a per servic
Eli the Bearded wrote:
> I recently saw a link to an old post on a blog and then started looking
> at the newer posts. This one:
>
> https://leancrew.com/all-this/2019/11/the-key-to-sorting-in-python/
>
> discusses ways to deal with useful sorting of movie / television show
> titles. Some initia
Eli the Bearded wrote:
> In comp.lang.python, Peter Otten <__pete...@web.de> wrote:
>> Eli the Bearded wrote:
>>> But what caught my eye most, as someone relatively new to Python but
>>> with long experience in C in Perl, is sorting doesn't take a
>
>
Chris Angelico wrote:
> On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote:
>> PS: If you are sorting files by size and checksum as part of a
>> deduplication effort consider using dict-s instead:
>
> Yeah, I'd agree if that's the purpose. B
Dr Rainer Woitok wrote:
> Ethan,
>
> On Friday, 2019-12-20 07:41:51 -0800, you wrote:
>
>> ...
>> In Python 3 `sys.stdout` is a character interface, not bytes.
>
> Does that mean that with Python 3 "Tarfile" is no longer able to write
> the "tar" file to a pipe? Or is there now another wa
Alan Bawden wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
> ...
>> So I was looking for a predefined object from the standard
>> library that already /is/ an iterator (with no need to use
>> »iter«).
>>
>> I found exactly one such object (which can be used after a
>> »from ... i
jezka...@gmail.com wrote:
> ok, so it could be like this?
Easy things to improve:
(1) Avoid iterating over indices.
Wrong:
for i in range(len(stuff)):
item = stuff[i]
...
Better:
for item in stuff:
...
(1a) If you need the index use enumerate():
for i, value in enumerate(stuff
1701 - 1800 of 9314 matches
Mail list logo