Re: Chardet oddity

2024-10-25 Thread Albert-Jan Roskam via Python-list
On Oct 24, 2024 17:51, Roland Mueller via Python-list wrote: ke 23. lokak. 2024 klo 20.11 Albert-Jan Roskam via Python-list ( python-list@python.org) kirjoitti: >    Today I used chardet.detect in the repl and it returned windows-1252 >    (incorrect, beca

Chardet oddity

2024-10-23 Thread Albert-Jan Roskam via Python-list
$ python -m chardet FILENAME FILENAME: MacRoman with confidence 0.7167379080370483 Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Synchronise annotations -> docstring

2024-09-03 Thread Albert-Jan Roskam via Python-list
Hi, Are there any tools that check whether type annotations and Numpydoc strings are consistent? I did find this Vim plugin: https://lxyuan0420.github.io/posts/til-vim-pydocstring-plugin. Looks incredibly useful, but I haven't tried it yet. Thanks! AJ -- https://mail.python

Re: ListAdmin: Is list/archive working correctly?

2024-08-31 Thread Albert-Jan Roskam via Python-list
I also think that list/archive isn't working properly. Very little emails. Before, this was quite a busy list. -- https://mail.python.org/mailman/listinfo/python-list

Re: Error codes

2024-08-13 Thread Albert-Jan Roskam via Python-list
On Aug 13, 2024 15:29, Barry Scott via Python-list wrote: > Could not find file 'C:\Users\Charl\OneDrive\Documents\The Sims 4 Mod Constructor\Projects\MetalMummysMods_Ehlers-DanlosMod\Python\__pycache__\MetalMummysMods_Ehlers-DanlosMod.cpython-37.pyc'. > Element ID: (No Elem

Re: Best use of "open" context manager

2024-07-12 Thread Albert-Jan Roskam via Python-list
Or like below, although pylint complains about this: "consider using with". Less indentation this way. f = None try: f = open(FILENAME) records = f.readlines() except Exception: sys.exit(1) finally: if f is not None: f.close() -- https://mai

Re: Suggested python feature: allowing except in context maneger

2024-06-16 Thread Albert-Jan Roskam via Python-list
The example exception is not what bothers me. The syntax change is nowhere near as useful as `with` and context managers. They provide an excellent idiom for resource usage and release. Your suggestion complicates the `with` statement and brings only a tiny indentation red

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Albert-Jan Roskam via Python-list
On Mar 10, 2024 12:59, Thomas Passin via Python-list wrote: On 3/10/2024 6:17 AM, Barry wrote: > > >> On 8 Mar 2024, at 23:19, Thomas Passin via Python-list wrote: >> >> We just learned a few posts back that it might be specific to Linux; I ran it on

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Albert-Jan Roskam via Python-list
On Mar 8, 2024 19:35, Thomas Passin via Python-list wrote: On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: > Hi, > I was replacing some os.path stuff with Pathlib and I discovered this: > Path(256 * "x").i

pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Albert-Jan Roskam via Python-list
Hi, I was replacing some os.path stuff with Pathlib and I discovered this: Path(256 * "x").is_file() # OSError os.path.isfile(256 * "x") # bool Is this intended? Does pathlib try to resemble os.path as closely as possible? Best wishes,

Re: Postgresql equivalent of Python's timeit?

2023-09-17 Thread Albert-Jan Roskam via Python-list
On Sep 15, 2023 19:45, "Peter J. Holzer via Python-list" wrote: On 2023-09-15 17:42:06 +0200, Albert-Jan Roskam via Python-list wrote: >    This is more related to Postgresql than to Python, I hope this is ok. >    I want to measure Postgres queries N

Postgresql equivalent of Python's timeit?

2023-09-15 Thread Albert-Jan Roskam via Python-list
n the times. Is there a timeit-like function in Postgresql? Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Passing info to function used in re.sub

2023-09-05 Thread Jan Erik Moström via Python-list
On 3 Sep 2023, at 18:10, Jan Erik Moström via Python-list wrote: > I'm looking for some advice for how to write this in a clean way Thanks for all the suggestion, I realize that I haven't written Python code in a while. I should have remembered this myself !!! Thanks for remindi

Re: Passing info to function used in re.sub

2023-09-03 Thread Jan Erik Moström via Python-list
On 3 Sep 2023, at 19:13, MRAB via Python-list wrote: > You could use pass an anonymous function (a lambda) to re.sub: Of course !! Thanks. = jem -- https://mail.python.org/mailman/listinfo/python-list

Passing info to function used in re.sub

2023-09-03 Thread Jan Erik Moström via Python-list
I'm looking for some advice for how to write this in a clean way I want to replace some text using a regex-pattern, but before creating replacement text I need to some file checking/copying etc. My code right now look something like this: def fix_stuff(m): # Do various things that invol

RE: Python installation not full and python not working 3.11.0

2023-03-10 Thread Jan Vasko
3.11.0 (full 64bit installer from python.org) * Downloaded from: Python Release Python 3.11.0 | Python.org<https://www.python.org/downloads/release/python-3110/> cmd: [cid:image006.png@01D953B0.4E12E170] This is resulting that I cannot use interpreter in VS Code and continue development.

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
On Feb 18, 2023 17:28, Rob Cliffe via Python-list wrote: On 18/02/2023 15:29, Thomas Passin wrote: > On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: >>     I sometimes use this trick, which I learnt from a book by Martelli. >>     Instead of try/exc

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
:         _cache.pop()     try:         return _cache[arg]     except KeyError:         result = expensivefunc(arg)         _cache[arg] = result         return result Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast lookup of bulky "table"

2023-01-16 Thread Albert-Jan Roskam
On Jan 15, 2023 05:26, Dino wrote: Hello, I have built a PoC service in Python Flask for my work, and - now that the point is made - I need to make it a little more performant (to be honest, chances are that someone else will pick up from where I left off, and implement

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Albert-Jan Roskam
On Dec 21, 2022 06:01, Chris Angelico wrote: On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > That's what I am taking this path under Windows now, the ultimate solution before Windows has shell similar to bash:-) Technically, Windows DOES have a shell similar to bash. It'

Re: Keeping a list of records with named fields that can be updated

2022-12-17 Thread Albert-Jan Roskam
On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> wrote: >>> from collections import namedtuple >>> Row = namedtuple("Row", "foo bar baz") >>> row = Row(1, 2, 3) >>> row._replace(bar=42) Row(foo=1, bar=42, baz=3) Ahh, I always thought these are undocumen

Re: Yaml.unsafe_load error

2022-10-19 Thread Albert-Jan Roskam
On Oct 19, 2022 13:02, Albert-Jan Roskam wrote:    Hi,    I am trying to create a celery.schedules.crontab object from an external    yaml file. I can successfully create an instance from a dummy class "Bar",    but the crontab class seems call __setsta

Yaml.unsafe_load error

2022-10-19 Thread Albert-Jan Roskam
code below. Thanks! Albert-Jan Python 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import yaml >>> f

Re: Find the path of a shell command

2022-10-14 Thread Albert-Jan Roskam
On Oct 14, 2022 18:19, "Peter J. Holzer" wrote: On 2022-10-14 07:40:14 -0700, Dan Stromberg wrote: > Alternatively, you can "ps axfwwe" (on Linux) to see environment > variables, and check what the environment of cron (or similar) is.  It > is this environment (mostly) that

Re: python developer

2022-10-03 Thread Jan van den Broek
2022-10-01, orzodk schrieb: > Jan van den Broek writes: > >> 2022-10-01, Mike Dewhirst schrieb: >> >>>So the answer to your question is signed email is easy and if it becomes >>>popular it has potential to defeat hackers. >> >> Yes, but I'

Re: python developer

2022-10-01 Thread Jan van den Broek
2022-10-01, Mike Dewhirst schrieb: >So the answer to your question is signed email is easy and if it becomes >popular it has potential to defeat hackers. Yes, but I'm reading this as a usenet-message (comp.lang.python), not as a mail. -- Jan v/d Broek balgl...@dds.n

Re: python developer

2022-09-30 Thread Jan van den Broek
2022-09-29, Mike Dewhirst schrieb: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) Why? [Schnipp] -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Book/resource recommendation about Celery?

2022-09-15 Thread Albert-Jan Roskam
Hi, I'm using Flask + Celery + RabbitMQ. Can anyone recommend a good book or other resource about Celery?  Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Fwd:

2022-09-09 Thread Jan Poort
error by starting up windows 10 i get this message -- Forwarded message - Van: Jan Poort Date: do 8 sep. 2022 om 15:49 Subject: To: -- *Jan Poort* -- https://mail.python.org/mailman/listinfo/python-list

Re: Register multiple excepthooks?

2022-08-04 Thread Albert-Jan Roskam
On Aug 1, 2022 19:34, Dieter Maurer wrote: Albert-Jan Roskam wrote at 2022-7-31 11:39 +0200: >   I have a function init_logging.log_uncaught_errors() that I use for >   sys.excepthook. Now I also want to call another function (ffi.dlclose()) >   upon

Register multiple excepthooks?

2022-07-31 Thread Albert-Jan Roskam
log_uncaught_errors() so it does both things? Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

What's up with modern Python programmers rewriting everything in Rust?

2022-06-20 Thread jan Anja via Python-list
Dude, it's called CPython for a reason. -- https://mail.python.org/mailman/listinfo/python-list

Re: new sorting algorithm

2022-05-02 Thread jan via Python-list
known to fix this pathology? cheers jan On 02/05/2022, Chris Angelico wrote: > On Mon, 2 May 2022 at 09:20, Dan Stromberg wrote: >> >> >> On Sun, May 1, 2022 at 1:44 PM Chris Angelico wrote: >>> >>> On Mon, 2 May 2022 at 06:43, Dan Stromberg wrote: >>

Re: Style for docstring

2022-04-23 Thread jan via Python-list
"return true iff this". I like this. jan On 23/04/2022, Stefan Ram wrote: > Rob Cliffe writes: >>I'm curious as to why so many people prefer "Return" to "Returns". > > The commands, er, names of functions, use the imperative mood > (

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Albert-Jan Roskam
On Apr 20, 2022 13:01, Sam Ezeh wrote: I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations

Re: flask app convert sql query to python plotly.

2022-04-04 Thread Albert-Jan Roskam
On Apr 2, 2022 20:50, Abdellah ALAOUI ISMAILI wrote: i would like to convert in my flask app an SQL query to an plotly pie chart using pandas. this is my code : def query_tickets_status() :     query_result = pd.read_sql ("""     SELECT COUNT(*)count_status

Fwd: dict.get_deep()

2022-04-04 Thread Albert-Jan Roskam
-- Forwarded message -- From: Marco Sulla Date: Apr 2, 2022 22:44 Subject: dict.get_deep() To: Python List <> Cc: A proposal. Very often dict are used as a deeply nested carrier of data, usually decoded from JSON.  data["users"][0]["address"]["str

Marshmallow: json-to-schema helper?

2022-04-04 Thread Albert-Jan Roskam
a())  # OSError https://marshmallow.readthedocs.io/en/stable/api_reference.html#marshmallow.Schema.from_dict https://docs.python.org/3/library/inspect.html#inspect.getsource Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: SQLAlchemy: JSON vs. PickleType vs. raw string for serialised data

2022-02-28 Thread Albert-Jan Roskam
On Feb 28, 2022 10:11, Loris Bennett wrote: Hi, I have an SQLAlchemy class for an event:   class UserEvent(Base):   __tablename__ = "user_events"   id = Column('id', Integer, primary_key=True)   date = Column('date', Date, nullable=False)  

Re: One-liner to merge lists?

2022-02-25 Thread Albert-Jan Roskam
If you don't like the idea of 'adding' strings you can 'concat'enate: >>> items = [[1,2,3], [4,5], [6]] >>> functools.reduce(operator.concat, items) [1, 2, 3, 4, 5, 6] >>> functools.reduce(operator.iconcat, items, []) [1, 2, 3, 4, 5, 6] The latter is the functio

Re: Long running process - how to speed up?

2022-02-19 Thread Albert-Jan Roskam
On Feb 19, 2022 12:28, Shaozhong SHI wrote: I have a cvs file of 932956 row and have to have time.sleep in a Python script.  It takes a long time to process. How can I speed up the processing?  Can I do multi-processing? Perhaps a dask df:  https://docs.dask.org/

Re: Error installing requirements

2022-02-19 Thread Albert-Jan Roskam
On Feb 18, 2022 08:23, Saruni David wrote: >> Christian Gohlke's site has a Pillow .whl for python 2.7: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow -- https://mail.python.org/mailman/listinfo/python-list

Re: Pypy with Cython

2022-02-03 Thread Albert-Jan Roskam
On Feb 3, 2022 17:01, Dan Stromberg wrote: > The best answer to "is this slower on > Pypy" is probably to measure. > Sometimes it makes sense to rewrite C > extension modules in pure python for pypy. Hi Dan, thanks. What profiler do you recommend I normally us

Pypy with Cython

2022-02-03 Thread Albert-Jan Roskam
f the program (e.g a modulo 11 digit check) are implemented in Cython. Should I use pure Python instead when using Pypy? I compiled the Cython modules for pypy and they work, but I'm afraid they might just slow things down. Thanks! Albert-Jan -- https://mail.python.org/mailman/listi

Re: Waht do you think about my repeated_timer class

2022-02-03 Thread Albert-Jan Roskam
On Feb 2, 2022 23:31, Barry wrote: > On 2 Feb 2022, at 21:12, Marco Sulla wrote: > > You could add a __del__ that calls stop :) Didn't python3 make this non deterministic when del is called? I thought the recommendation is to not rely on __del__ in python3 code

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-08 Thread Albert-Jan Roskam
to easily set the transfer encoding to gzip Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Call julia from Python: which package?

2021-12-21 Thread Albert-Jan Roskam
e how this Julia/Python interaction might work. The little bit of experience with Julia more or less coincides with what Oscar mentioned: a lot of "warm up" time. This is actually a py2.7 project that I inherited. I was asked to convert it to py3.8. Thanks and merry xmas

Call julia from Python: which package?

2021-12-17 Thread Albert-Jan Roskam
.html# * https://pypi.org/project/juliacall/ * https://github.com/JuliaPy/PyCall.jl Thanks in advance! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: How to apply a self defined function in Pandas

2021-10-31 Thread Albert-Jan Roskam
> df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1) I think you need axis=0. Or use the Series, df['URL'] = df.URL.apply(connect) -- https://mail.python.org/mailman/listinfo/python-list

Ansible, pip and virtualenv

2021-10-31 Thread Albert-Jan Roskam
in advance! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Tracing in a Flask application

2021-08-09 Thread Albert-Jan Roskam
Hi, logging.basicConfig(level="DEBUG") ..in e.g __init__.py AJ On 4 Aug 2021 23:26, Javi D R wrote: Hi I would like to do some tracing in a flask. I have been able to trace request in plain python requests using sys.settrace(), but this doesnt work with F

Re: argparse support of/by argparse

2021-07-23 Thread Albert-Jan Roskam
>>> [1] https://pypi.org/project/clize/ I use and like docopt (https://github.com/docopt/docopt). Is clize a better choice? -- https://mail.python.org/mailman/listinfo/python-list

Re: Optimizing Small Python Code

2021-06-24 Thread jan via Python-list
ity of an object, such as a piece of text, is the length of a shortest computer program (in a predetermined programming language) that produces the object as output". cheers jan On 24/06/2021, Avi Gross via Python-list wrote: > Jan, > > As an academic discussion, yes, many enhance

Re: Optimizing Small Python Code

2021-06-24 Thread jan via Python-list
large n it would become obvious. jan On 24/06/2021, Avi Gross via Python-list wrote: > Yes, I agree that if you do not need to show your work to a human, then the > problem specified could be solved beforeand and a simple print statement > would suffice. > > Ideally you want to make

Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-13 Thread jan via Python-list
my impression is there are a few, vocal people who are just there to disrupt rather than do anything constructive. That may be reporting bias though so my view may be of questionable reliability. Basically I've not seen much if any value in this PC stuff. > > > What do you think a professionally-recognisable series of skill-levels > for programmers? Fine. If you can do it in any meaningful sense. jan > > -- > Regards, > =dn > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Recommendation for drawing graphs and creating tables, saving as PDF

2021-06-11 Thread Jan Erik Moström
I'm doing something that I've never done before and need some advise for suitable libraries. I want to a) create diagrams similar to this one https://www.dropbox.com/s/kyh7rxbcogvecs1/graph.png?dl=0 (but with more nodes) and save them as PDFs or some format that can easily be converted to PD

Async code across Python versions

2021-06-03 Thread Albert-Jan Roskam
is it better to use 3rd party libraries? It seems that things get a little easier with newer Python versions, so it might also a reason to simplify the code. Cheers! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Async requests library with NTLM auth support?

2021-06-03 Thread Albert-Jan Roskam
> Asyncio and httpx [1] look promising but don't seem to support ntlm. Any tips? ==> https://pypi.org/project/httpx-ntlm/ Not sure how I missed this in the first place. :-) -- https://mail.python.org/mailman/listinfo/python-list

Async requests library with NTLM auth support?

2021-06-01 Thread Albert-Jan Roskam
Hi, I need to make thousands of requests that require ntlm authentication so I was hoping to do them asynchronously. With synchronous requests I use requests/requests_ntlm. Asyncio and httpx [1] look promising but don't seem to support ntlm. Any tips? Cheers! Albert-Jan

Re: Python install failing. Install log is available.

2021-05-21 Thread jan via Python-list
OK, but 1. should the installer work for administrator + all users or not? 2. if not, should the installer work for me (a non-admin) and install python correctly and successfully for my account if I run it in my account, not the admin? thanks jan On 20/05/2021, Terry Reedy wrote: > On 5

Python install failing. Install log is available.

2021-05-20 Thread jan via Python-list
sApps;C:\Users\Administrator\.dotnet\tools It's there, but from a non-admin console (I work just a normal user): C:\Users\jan>whoami antik\jan C:\Users\jan>echo %path% C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program F

Re: [OT] Annoying message duplication, was Re: Unsubscribe/can't login

2021-05-05 Thread Jan van den Broek
derbird's context menu: Followup to > Newsgroup. > > Does that appear once or twice? Here, once. -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Annoying message duplication, was Re: Unsubscribe/can't login

2021-05-05 Thread Jan van den Broek
in this this thread are dupes for me and I > can't remember the last time I saw a dupe from you. Are you reading this via the mailinglist or Usenet? -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: Unsubscribe/can't login

2021-05-05 Thread Jan van den Broek
On 2021-05-05, Peter Otten <__pete...@web.de> wrote: > On 05/05/2021 13:03, Jan van den Broek wrote: >> On 2021-05-05, Peter Otten <__pete...@web.de> wrote: >> >> Perhaps there's something wrong on my side, but I'm >> seeing this message twice: [

Re: Unsubscribe/can't login

2021-05-05 Thread Jan van den Broek
ython.org Return-Path: python-python-l...@m.gmane-mx.org -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-21 Thread Albert-Jan Roskam
On 20 Mar 2021 23:47, Cameron Simpson wrote: On 20Mar2021 12:53, Sibylle Koczian wrote: >Am 20.03.2021 um 09:34 schrieb Alan Bawden: >>The real reason Python strings support a .title() method is surely >>because Unicode supports upper, lower, _and_ title case letters, and

Re: Packaging/MANIFEST.in: Incude All, Exclude .gitignore

2021-03-13 Thread Albert-Jan Roskam
you could call a simple bash script in a git hook that syncs your MANIFEST.in with your .gitignore. Something like: echo -n "exclude " > MANIFEST.in cat .gitignore | tr '\n' ' ' >> MANIFEST.in echo "graft $(readlink -f ./keep/this)" >> MANIFEST.in https://docs.python.org/2/distuti

Library for text substitutions with calculations?

2020-12-15 Thread Jan Erik Moström
I want to do some text substitutions but a bit more advanced than what string.Template class can do. I addition to plain text substitution I would like to be able to do some calculations: $value+1 - If value is 16 this would insert 17 in the text. I would also like to subtract. $value+1w - I

Re: nonlocal fails ?

2019-11-14 Thread Jan Erik Moström
On 14 Nov 2019, at 15:15, R.Wieser wrote: Too bad though, it means that procedures that want to share/use its callers variables using nonlocal can never be called from main. And that a caller of a procedure using nonlocal cannot have the variable declared as global (just tested it). So wha

Re: nonlocal fails ?

2019-11-14 Thread Jan Erik Moström
On 14 Nov 2019, at 14:06, R.Wieser wrote: I've also tried moving "MyVar = 7" to the first line, but that doesn't change anything. Using "global MyVar" works.. Try def outer(): MyVar = 10 def Proc1(): nonlocal MyVar MyVar = 5 Proc1()

Re: Win32api problems

2019-10-22 Thread Albert-Jan Roskam
On 22 Oct 2019 11:23, GerritM wrote: > ImportError: DLL load failed: The specified > procedure could not be found. I've had the same error before and I solved it by adding the location where the win32 dlls live to PATH. Maybe PATH gets messed up during the installation of something. -- htt

Re: python2 vs python3

2019-10-21 Thread Albert-Jan Roskam
On 18 Oct 2019 20:36, Chris Angelico wrote: On Sat, Oct 19, 2019 at 5:29 AM Jagga Soorma wrote: > > Hello, > > I am writing my second python script and got it to work using > python2.x. However, realized that I should be using python3 and it > seems to fail with the following message: > > --

Re: sqlalchemy & #temp tables

2019-10-11 Thread Albert-Jan Roskam
On 8 Oct 2019 07:49, Frank Millman wrote: On 2019-10-07 5:30 PM, Albert-Jan Roskam wrote: > Hi, > > I am using sqlalchemy (SA) to access a MS SQL Server database (python 3.5, > Win 10). I would like to use a temporary table (preferably #local, but > ##global would also b

sqlalchemy & #temp tables

2019-10-07 Thread Albert-Jan Roskam
pe of the context manager. Oh, I don't have rights to create a 'real' table. :-( Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Recursive method in class

2019-09-27 Thread Jan van den Broek
return fib(self, n-2) + fib(self, n-1) self.fib(...) [Schnipp] -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: Funny code

2019-09-26 Thread Albert-Jan Roskam
On 26 Sep 2019 10:28, Christian Gollwitzer wrote: Am 26.09.19 um 08:34 schrieb ast: > Hello > > A line of code which produce itself when executed > > >>> s='s=%r;print(s%%s)';print(s%s) > s='s=%r;print(s%%s)';print(s%s) > > Thats funny ! ==> Also impressive, a 128-language quine: https://git

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Albert-Jan Roskam
k it's a deliberate design choice that decimal and thousands where used here as params, and not a 'locale' param? It seems nice to be able to specify e.g. locale='dutch' and then all the right lc_numeric, lc_monetary, lc_time where used. Or even locale='nl_NL.1252' and you also wouldn't need 'encoding' as a separate param. Or might that be bad on windows where there's no locale-gen? Just wondering... Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Document Entire Apps

2019-09-21 Thread Albert-Jan Roskam
On 15 Sep 2019 07:00, Sinardy Gmail wrote: I understand that we can use pydoc to document procedures how about the relationship between packages and dependencies ? ==》 Check out snakefood to generate dependency graphs: http://furius.ca/snakefood/. Also, did you discover sphinx already? --

Re: Creating time stamps

2019-07-22 Thread Albert-Jan Roskam
On 22 Jul 2019 23:12, Skip Montanaro wrote: Assuming you're using Python 3, why not use an f-string? >>> dt = datetime.datetime.now() >>> dt.strftime("%Y-%m-%d %H:%M") '2019-07-22 16:10' >>> f"{dt:%Y-%m-%d %H:%M}" '2019-07-22 16:10' ===》》 Or if you're running < Python 3.6 (no f strings): form

Re: Most "pythonic" syntax to use for an API client library

2019-04-28 Thread Albert-Jan Roskam
On 29 Apr 2019 07:18, DL Neil wrote: On 29/04/19 4:52 PM, Chris Angelico wrote: > On Mon, Apr 29, 2019 at 2:43 PM DL Neil > wrote: >> >> On 29/04/19 3:55 PM, Chris Angelico wrote: >>> On Mon, Apr 29, 2019 at 1:43 PM DL Neil >>> wrote: Well, seeing you ask: a more HTTP-ish approach *mi

Re: What Python related git pre-commit hooks are you using?

2018-11-18 Thread Albert-Jan Roskam
On 18 Nov 2018 20:33, Malcolm Greene wrote: >Curious to learn what Python related git >pre-commit hooks people are using? >What >hooks have you found useful and which >hooks have you tried I use Python to reject large commits (pre-commit hook): http://code.activestate.com/recipes/578883-git

[OT] master/slave debate in Python

2018-09-23 Thread Albert-Jan Roskam
*sigh*. I'm with Hettinger on this. https://www.theregister.co.uk/2018/09/11/python_purges_master_and_slave_in_political_pogrom/ -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3.7 - I try to close the thread without closing the GUI is it possible?

2018-09-15 Thread Albert-Jan Roskam
> I try to close the thread without closing the GUI is it possible? Qthread seems to be worth investigating: https://medium.com/@webmamoffice/getting-started-gui-s-with-python-pyqt-qthread-class-1b796203c18c -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Python on a fork-less POSIX-like OS

2018-07-29 Thread Jan Claeys
> > My question is that the _posixsubprocess.c can be prepared to > use posix_spawn(3) instead of fork(2)? Maybe the UNIX/Linux version > can also benefit from it, see: https://salsa.debian.org/ruby- > team/ruby-posix-spawn You might want to ask this on the python-dev mailing list. -- Ja

Re: Non-GUI, single processort inter process massaging - how?

2018-07-22 Thread Jan Claeys
y other HTTP client... -- Jan Claeys -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido van Rossum resigns as Python leader

2018-07-14 Thread Jan van den Broek
[1] https://nl.wikipedia.org/wiki/Bestand:NederlandseProvinciesLarge.png -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido van Rossum resigns as Python leader

2018-07-14 Thread Jan van den Broek
probably lead to ending every statement in your code with "lol !". -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: user defined modules

2018-06-09 Thread Albert-Jan Roskam
On 5 Jun 2018 09:32, Steven D'Aprano wrote: On Mon, 04 Jun 2018 20:13:32 -0700, Sharan Basappa wrote: > Is there a specific location where user defined modules need to be kept? > If not, do we need to specify search location so that Python interpreter > can find it? Python modules used as s

Re: Extract data from multiple text files

2018-05-15 Thread Albert-Jan Roskam
On May 15, 2018 14:12, mahesh d wrote: import glob,os import errno path = 'C:/Users/A-7993\Desktop/task11/sample emails/' files = glob.glob(path) '''for name in files: print(str(name)) if name.endswith(".txt"): print(name)''' for file in os.listdir(path): print(f

Re: Extract data

2018-05-15 Thread Albert-Jan Roskam
On May 15, 2018 08:54, Steven D'Aprano wrote: On Tue, 15 May 2018 11:53:47 +0530, mahesh d wrote: > Hii. > > I have folder.in that folder some files .txt and some files .msg files. > . > My requirement is reading those file contents . Extract data in that > files . Reading .msg can be done

Re: The basics of the logging module mystify me

2018-04-20 Thread Albert-Jan Roskam
On Apr 19, 2018 03:03, Skip Montanaro wrote: > > > I really don't like the logging module, but it looks like I'm stuck > with it. Why aren't simple/obvious things either simple or obvious? Agreed. One thing that, in my opinion, ought to be added to the docs is sample code to log uncaught except

Re: RE newbie question

2018-04-18 Thread Albert-Jan Roskam
On Apr 18, 2018 21:42, TUA wrote: > > import re > > compval = 'A123456_8' > regex = '[a-zA-Z]\w{0,7}' > > if re.match(regex, compval): >print('Yes') > else: >print('No') > > > My intention is to implement a max. length of 8 for an input string. The > above works well in all other respect

Flask test generator code review?

2018-04-18 Thread Albert-Jan Roskam
the docstring of test_generator? This would make the nosetests output a bit more understandable. Thanks! Albert-Jan import os import sys from os.path import splitext from http import HTTPStatus as status import nose from MyFabulousApp import app app.testing = True template_folder

Re: How to write partial of a buffer which was returned from a C function to a file?

2018-04-12 Thread Albert-Jan Roskam
On Apr 12, 2018 09:39, jf...@ms4.hinet.net wrote: > > Chris Angelico於 2018年4月12日星期四 UTC+8下午1時31分35秒寫道: > > On Thu, Apr 12, 2018 at 2:16 PM, wrote: > > > This C function returns a buffer which I declared it as a > > > ctypes.c_char_p. The buffer has size 0x1 bytes long and the valid > > > d

Re: Pandas, create new column if previous column(s) are not in [None, '', np.nan]

2018-04-11 Thread Albert-Jan Roskam
On Apr 11, 2018 20:52, zljubi...@gmail.com wrote: > > I have a dataframe: > > import pandas as pd > import numpy as np > > df = pd.DataFrame( { 'A' : ['a', 'b', '', None, np.nan], > 'B' : [None, np.nan, 'a', 'b', '']}) > > A B > 0 a None > 1 b NaN > 2

Re: Asynchronous processing is more efficient -- surely not?

2018-04-04 Thread Jan Erik Moström
On 4 Apr 2018, at 9:27, Steven D'Aprano wrote: Its as hard to wrap your brain around as parallel processing in general, but with even worse performance than sequential processing. Am I totally wrong? I would say that it all depends on what kind of stuff you're doing. I'm no scheduling exper

Re: macOS specific - reading calendar information

2018-03-15 Thread Jan Erik Moström
On 14 Mar 2018, at 21:40, Larry Martell wrote: I've been trying to find some example of how to read calendar info on macOS but I haven't found anything ... I'm probably just bad at searching !! What I want to do is to read calendar info for a date range. Does anyone know of an example of ho

macOS specific - reading calendar information

2018-03-14 Thread Jan Erik Moström
I've been trying to find some example of how to read calendar info on macOS but I haven't found anything ... I'm probably just bad at searching !! What I want to do is to read calendar info for a date range. Does anyone know of an example of how to do this? = jem -- https://mail.python.org/m

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Jan van den Broek
comp.lang.idl-pvwave, a message is now displayed, >stating that the group owner needs to remove the spam, and can then apply >to Google in order to have access reinstated. [Schnipp] Personally I would see this as an improvement. -- Jan v/d Broek balgl...@dds.nl -- https://mail.python.

Re: Simple graphic library for beginners

2018-01-11 Thread Jan Erik Moström
On 10 Jan 2018, at 13:40, Jan Erik Moström wrote: I'm looking for a really easy to use graphic library. The target users are teachers who have never programmed before and is taking a first (and possible last) programming course. Thanks for all the suggestions, I'm going to take

  1   2   3   4   5   6   7   8   >