Re: on the python paradox

2022-12-11 Thread Martin Di Paola
On Mon, Dec 05, 2022 at 10:37:39PM -0300, Sabrina Almodóvar wrote: The Python Paradox Paul Graham August 2004 [SNIP] Hence what, for lack of a better name, I'll call the Python paradox: if a company chooses to write

Re: Which architectures to support in a CI like Travis?

2022-09-19 Thread Martin Di Paola
I would depend on the project. In the crytoanalysis tool that I developing, "cryptonita", I just manipule bytes. Nothing that could depend on the distro so my CI picks one OS and run the tests there. Project: https://github.com/cryptonitas/cryptonita CI: https://github.com/cryptonitas/cryptonit

Re: Simple TCP proxy

2022-07-27 Thread Martin Di Paola
On Wed, Jul 27, 2022 at 08:32:31PM +0200, Morten W. Petersen wrote: You're thinking of the backlog argument of listen? From my understanding, yes, when you set up the "accepter" socket (the one that you use to listen and accept new connections), you can define the length of the queue for inco

Re: exec() an locals() puzzle

2022-07-20 Thread Martin Di Paola
I did a few tests # test 1 def f(): i = 1 print(locals()) exec('y = i; print(y); print(locals())') print(locals()) a = eval('y') print(locals()) u = a print(u) f() {'i': 1} 1 {'i': 1, 'y': 1} {'i': 1, 'y': 1} {'i': 1, 'y': 1, 'a': 1} 1 # test 2 def f(): i = 1

Re: list indices must be integers or slices, not str

2022-07-20 Thread Martin Di Paola
offtopic If you want a pure-python but definitely a more hacky implementation, you can play around with inspect.stack() and get the variables from the outer frames. # code: x = 32 y = 42 printf("Hello x={x}, y={y}", x=27) # output: Hello x=27, y=42 The implementation of printf() was never re

Re: Simple message passing system and thread safe message queue

2022-07-18 Thread Martin Di Paola
Hi, I couldn't read your posts, every time I try to open one I'm redirected to an index page. I took a look at the smps project and I as far I understand it is a SSL client that sends messages to a server that implements a store of messages. I would suggest to remove the sleep() calls and as a c

Re: TENGO PROBLEMAS AL INSTALAR PYTHON

2022-07-08 Thread Martin Di Paola
On Fri, Jul 08, 2022 at 04:15:35PM -0600, Mats Wichmann wrote: In addition... there is no "Python 10.0" ... Mmm, perhaps that's the problem :D @Angie Odette Lima Banguera, vamos a necesitar algun traceback o algo para guiarte. Podes tambien buscar en internet (youtube) q hay varios tutori

Re: Filtering XArray Datasets?

2022-06-07 Thread Martin Di Paola
Hi, I'm not an expert on this so this is an educated guess: You are calling drop=True and I presume that you want to delete the rows of your dataset that satisfy a condition. That's a problem. If the underlying original data is stored in a dense contiguous array, deleting chunks of it will leav

Re: Request for assistance (hopefully not OT)

2022-05-17 Thread Martin Di Paola
Try to reinstall python and only python and if you succeeds, then try to reinstall the other tools. For this, use "apt-get" instead of "apt" $ sudo apt-get reinstall python3 When a system is heavily broken, be extra careful and read the output of the programs. If "apt-get" says than in order to

Re: Changing calling sequence

2022-05-13 Thread Martin Di Paola
You probably want something like overload/multiple dispatch. I quick search on PyPI yields a 'multipledispatch' package. I never used, however. On Wed, May 11, 2022 at 08:36:26AM -0700, Tobiah wrote: On 5/11/22 06:33, Michael F. Stemper wrote: I have a function that I use to retrieve daily dat

Re: Accuracy of multiprocessing.Queue.qsize before any Queue.get invocations?

2022-05-13 Thread Martin Di Paola
If the queue was not shared to any other process, I would guess that its size is reliable. However, a plain counter could be much simpler/safer. The developer of multiprocessing.Queue, implemented size() thinking in how to share the size and maintain a reasonable consistency between process. He/

Re: Could frozendict or frozenmap be of some use for PEP 683 (Immortal objects)?

2022-03-09 Thread Martin Di Paola
I perhaps didn't understand the PEP completely but I think that the goal of marking some objects as immortal is to remove the refcount from they. For immutable objects that would make them truly immutable. However I don't think that the immortality could be applied to any immutable object by def

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-08 Thread Martin Di Paola
Then, you must put the initialization (dynamically loading the modules) into the function executed in the foreign process. You could wrap the payload function into a class instances to achieve this. In the foreign process, you call the instance which first performs the initialization and then exe

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-07 Thread Martin Di Paola
7; in sys.modules True So the last check proves that pickle.loads imports any necessary module. Martin. On Mon, Mar 07, 2022 at 08:28:15AM +, Barry wrote: On 7 Mar 2022, at 02:33, Martin Di Paola wrote: Yes but I think that unpickle (pickle.loads()) does that plus importing any mod

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Yeup, that would be my first choice but the catch is that "sayhi" may not be a function of the given module. It could be a static method of some class or any other callable. Ah, fair. Are you able to define it by a "path", where each step in the path is a getattr() call? Yes but I think th

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
I'm not so sure about that. The author of the plugin knows they're writing code that will be dynamically loaded, and can therefore expect the kind of problem they're having. It could be argued that it's their responsibility to ensure that all the needed code is loaded into the subprocess. Ye

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Try to use `fork` as "start method" (instead of "spawn"). Yes but no. Indeed with `fork` there is no need to pickle anything. In particular the child process will be a copy of the parent so it will have all the modules loaded, including the dynamic ones. Perfect. The problem is that `fork` is t

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
The way you've described it, it's a hack. Allow me to slightly redescribe it. modules = loader() objs = init(modules) def invoke(mod, func): # I'm assuming that the loader is smart enough to not load # a module that's already loaded. Alternatively, load just the # module you need,

Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Hi everyone. I implemented time ago a small plugin engine to load code dynamically. So far it worked well but a few days ago an user told me that he wasn't able to run in parallel a piece of code in MacOS. He was using multiprocessing.Process to run the code and in MacOS, the default start metho

Re: library not initialized (pygame)

2022-02-19 Thread Martin Di Paola
Could you share the traceback / error that you are seeing? On Sun, May 02, 2021 at 03:23:21PM -0400, Quentin Bock wrote: Code: #imports and variables for game import pygame from pygame import mixer running = True #initializes pygame pygame.init() #creates the pygame window screen = pygame.dis

Re: venv and executing other python programs

2022-02-17 Thread Martin Di Paola
That's correct. I tried to be systematic in the analysis so I tested all the possibilities. Your test results were unexpected for `python3 -m venv xxx`. By default, virtual environments exclude the system and user site packages. Including them should require the command-line argument `--system-

Re: venv and executing other python programs

2022-02-15 Thread Martin Di Paola
If you have activated the venv then any script that uses /usr/bin/env will use executables from the venv bin folder. That's correct. I tried to be systematic in the analysis so I tested all the possibilities. I avoid all these issues by not activating the venv. Python has code to know how

Re: venv and executing other python programs

2022-02-15 Thread Martin Di Paola
I did a few experiments in my machine. I created the following foo.py import pandas print("foo") Now "pandas" is installed under Python 3 outside the venv. I can run it successfully calling "python3 foo.py". If I add the shebang "#!/usr/bin/env python3" (notice the 3), I can also run it

Re: How do you log in your projects?

2022-02-10 Thread Martin Di Paola
? Logs are not intended to be read by end users. Logs are primarily used to understand what the code is doing in a production environment. They could also be used to gather metrics data. Why should you log to give a message instead of simply using a print? You are assuming that logs and prints

Re: How do you log in your projects?

2022-02-09 Thread Martin Di Paola
- On a line per line basis? on a function/method basis? In general I prefer logging line by line instead per function. It is easy to add a bunch of decorators to the functions and get the logs of all the program but I most of the time I end up with very confusing logs. There are exceptions,

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Martin Di Paola
In _run I first set the new timer and then I execute the function. So that will go mostly OK. Yes, that's correct however you are not taking into consideration the imprecision of the timers. Timer will call the next _run() after self._interval *plus* some unknown arbitrary time (and extra

Re: sharing data across Examples docstrings

2022-01-14 Thread Martin Di Paola
Hello, I understand that you want to share data across examples (docstrings) because you are running doctest to validate them (and test). The doctest implementation evaluates each docstring separately without sharing the context so the short answer is "no". This is a limitation of doctest b

Re: Call julia from Python: which package?

2021-12-18 Thread Martin Di Paola
I played with Julia a few months ago. I was doing some data-science stuff with Pandas and the performance was terrible so I decided to give Julia a try. My plan was to do the slow part in Julia and call it from Python. I tried juliacall (if I don't remember wrong) but I couldn't set up it.

Re: threading and multiprocessing deadlock

2021-12-06 Thread Martin Di Paola
Hi!, in short your code should work. I think that the join-joined problem is just an interpretation problem. In pseudo code the background_thread function does: def background_thread() # bla print("join?") # bla print("joined") When running this function in parallel using threads, you

Re: The task is to invent names for things

2021-10-28 Thread Martin Di Paola
IMHO, I prefer really weird names. For example if I'm not sure how to name a class that I'm coding, I name it like XXXYYY (literally). Really ugly. This is a way to avoid the so called "naming paralysis". Once I finish coding the class I look back and it should be easy to see "what it does" and

Re: Select columns based on dates - Pandas

2021-09-03 Thread Martin Di Paola
You may want to reshape the dataset to a tidy format: Pandas works better with that format. Let's assume the following dataset (this is what I understood from your message): In [34]: df = pd.DataFrame({ ...: 'Country': ['us', 'uk', 'it'], ...: '01/01/2019': [10, 20, 30], ...: '02/

Re: basic auth request

2021-08-21 Thread Martin Di Paola
While it is correct to say that Basic Auth without HTTPS is absolutely insecure, using Basic Auth *and* HTTPS is not secure either. Well, the definition of "secure" depends of your threat model. HTTPS ensures encryption so the content, including the Basic Auth username and password, is secret

Re: on perhaps unloading modules?

2021-08-17 Thread Martin Di Paola
This may not answer your question but it may provide an alternative solution. I had the same challenge that you an year ago so may be my solution will work for you too. Imagine that you have a Markdown file that *documents* the expected results. --8<---cut here---st

Re: Empty list as a default param - the problem, and my suggested solution

2021-08-14 Thread Martin Di Paola
I don't know if it is useful but it is an interesting metaprogramming/reflection challenge. You used `inspect` but you didn't take its full potential. Try to see if you can simplify your code and see if you can come with a decorator that does not require special parameters. from new import N

Re: [ANN] Austin -- CPython frame stack sampler v3.0.0 is now available

2021-07-02 Thread Martin Di Paola
Very nice. I used rbspy for Ruby programs https://rbspy.github.io/ and it can give you some insights about the running code that other profiling techniques may not give you. I'll use it in my next performance-bottleneck challenge. On Fri, Jul 02, 2021 at 04:04:24PM -0700, Gabriele Tornetta wro

Re: optimization of rule-based model on discrete variables

2021-06-14 Thread Martin Di Paola
From what I'm understanding it is an "optimization problem" like the ones that you find in "linear programming". But in your case the variables are not Real (they are Integers) and the function to minimize g() is not linear. You could try/explore CVXPY (https://www.cvxpy.org/) which it's a so

Re: Recommendation for drawing graphs and creating tables, saving as PDF

2021-06-11 Thread Martin Di Paola
You could try https://plantuml.com and http://ditaa.sourceforge.net/. Plantuml may not sound as the right tool but it is quite flexible and after a few tweak you can create a block diagram as you shown. And the good thing is that you *write* which elements and relations are in your diagram an

Re: Data structure for plotting monotonically expanding data set

2021-06-05 Thread Martin Di Paola
One way to go is using Pandas as it was mentioned before and Seaborn for plotting (built on top of matplotlib) I would approach this prototyping first with a single file and not with the 1000 files that you have. Using the code that you have for parsing, add the values to a Pandas DataFrame

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-23 Thread Martin Di Paola
"unselectable text" not necessary means that it is an image. There is a CSS property that you can change to make a text selectable/unselectable. And if it is an image, it very likely that it comes from the server as such, so "intercepting" the packet coming from there will be for nothing: you

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-22 Thread Martin Di Paola
Hello, I'm not 100% sure but I think that I understand what you are trying to do. I faced the same problem a few months ago. I wanted to know when a particular blog posted a new article. My plan was to query the blog every day running a python script, get the list of articles it has and compari

byexample: free, open source tool to find snippets of code in your docs and execute them as regression tests

2021-05-03 Thread Martin Di Paola
Hi everyone, I would like to share a free, open source tool with you that I've been developing in the last few years. You'll be probably familiar with things like this in the Python documentation: ``` >>> 1 + 3 4 ``` byexample will find those snippets, it will execute "1 + 3" and the output

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 23:16:10 UTC+1, cameron...@gmail.com wrote: > On 20Dec2020 20:34, Karsten Hilbert wrote: > >> Trust me: it takes 100x getting anything done plus keep up with your > >> prayers, and it takes 100^100x learning anything solid, as in just forget > >> about it. Indeed,

Re: Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 19:54:08 UTC+1, Karsten Hilbert wrote: > > > So what you are looking for is the form of a potential > > > "timeout exception" (say, exception name) ? > > > > > > Provoke one and have a look. > > > > > > Then catch what you saw. > > > >

Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 19:35:21 UTC+1, Karsten Hilbert wrote: > > If it's a timeout exception I'm going to delay a little while and then > > try again. The timeout is probably because the server is busy. > > So what you are looking for is the form of a potential > "timeout exception" (s

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 18:18:26 UTC+1, Chris Green wrote: > If I ignore the exception then the > program just exits, if I want the program to do something useful about > it (like try again) then I have to catch the specific exception as I > don't want to try again with other exceptions.

Re: Lambda in parameters

2020-12-18 Thread Julio Di Egidio
On Friday, 18 December 2020 at 15:20:59 UTC+1, Abdur-Rahmaan Janhangeer wrote: > The Question: > > # --- > This problem was asked by Jane Street. > > cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first > and last element of that pair. For example, car(cons(3, 4)) retur

Re: help(list[int]) → TypeError

2020-12-04 Thread Julio Di Egidio
On Thursday, 3 December 2020 at 19:28:19 UTC+1, Paul Bryan wrote: > Is this the correct behavior? > > Python 3.9.0 (default, Oct 7 2020, 23:09:01) > [GCC 10.2.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> help(list[int]) > Traceback (most recent ca

Re: Question on ABC classes

2020-10-29 Thread Julio Di Egidio
On Friday, 30 October 2020 05:09:34 UTC+1, Chris Angelico wrote: > On Fri, Oct 30, 2020 at 1:06 PM Julio Di Egidio wrote: > > On Sunday, 25 October 2020 20:55:26 UTC+1, Peter J. Holzer wrote: > > > I think you are trying to use Python in a way contrary to its nature.

Re: Question on ABC classes

2020-10-29 Thread Julio Di Egidio
On Sunday, 25 October 2020 20:55:26 UTC+1, Peter J. Holzer wrote: > On 2020-10-22 23:35:21 -0700, Julio Di Egidio wrote: > > On Friday, 23 October 2020 07:36:39 UTC+2, Greg Ewing wrote: > > > On 23/10/20 2:13 pm, Julio Di Egidio wrote: > > > > I am now thinki

Re: Question on ABC classes

2020-10-22 Thread Julio Di Egidio
On Friday, 23 October 2020 07:36:39 UTC+2, Greg Ewing wrote: > On 23/10/20 2:13 pm, Julio Di Egidio wrote: > > I am now thinking whether I could achieve the "standard" > > behaviour via another approach, say with decorators, somehow > > intercepting calls to __new__

Re: Question on ABC classes

2020-10-22 Thread Julio Di Egidio
On Thursday, 22 October 2020 23:04:25 UTC+2, Ethan Furman wrote: > On 10/22/20 9:25 AM, Julio Di Egidio wrote: > > > Now, I do read in the docs that that is as intended, > > but I am not understanding the rationale of it: why > > only if there are abstract methods define

Question on ABC classes

2020-10-22 Thread Julio Di Egidio
Hello guys, I am professional programmer but quite new to Python, and I am trying to get the grips of some peculiarities of the language. Here is a basic question: if I define an ABC class, I can still instantiate the class unless there are abstract methods defined in the class. (In the typical

Transcrypt - Games for Kids

2016-06-27 Thread Salvatore DI DIO
Hello, I am using Transcrypt (Python to Javascript translator) to create games for kids, and introduce them to programming. You can give an eye here : https://github.com/artyprog/GFK Regards -- https://mail.python.org/mailman/listinfo/python-list

ArtWork in PyPyBox - Pure Python

2016-03-30 Thread Salvatore DI DIO
In pure Python, here is a nice image (for me at least) http://salvatore.diodev.fr/pypybox/ Regards -- https://mail.python.org/mailman/listinfo/python-list

HELP! With calculating

2016-03-30 Thread Yum Di
import random import time print ("Welcome to Pizza Shed!") tablenum = input ("Enter table number from 1-25 \n ") while tablenum>25 or tablenum <=0: tablenum = input ("Enter the correct table number, there are only 25 tables ") #Pizza menu with prices print ("-") pr

Calculate Bill

2016-03-29 Thread Yum Di
import random import time print ("Welcome to Pizza Shed!") order = raw_input ("\n\nPLEASE PRESS ENTER TO ORDER." ) tablenum = input ("Enter table number from 1-25 \n ") while tablenum>25 or tablenum <=0: tablenum = input ("Enter the correct table number, there are only 25 tables ") #Pi

Re: Help with python code

2016-03-29 Thread Yum Di
import random import time pizzatype = [3.50,4.20,5.20,5.80,5.60] drinktype = [0.90,0.80,0.90] topping = [0.50,0.50,0.50,0.50] def Total_cost_cal (pt ,dt ,t): total = pt + dt + t return total print ("Welcome to Pizza Shed!") order = raw_input ("\n\nPLEASE PRESS ENTER TO ORDER." ) tablen

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 19:52:45 UTC+1, Terry Reedy a écrit : > On 3/19/2016 1:06 PM, Salvatore DI DIO wrote: > > Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : > >> Le 19/03/2016 16:32, Salvatore DI DIO a écrit : > >>> Le samedi 19 mars 2016 16:2

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : > Le 19/03/2016 16:32, Salvatore DI DIO a écrit : > > Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit : > >> Hy all, > >> > >> I am experimenting PyPyJS and found it not so

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : > Le 19/03/2016 16:32, Salvatore DI DIO a écrit : > > Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit : > >> Hy all, > >> > >> I am experimenting PyPyJS and found it not so

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit : > Hy all, > > I am experimenting PyPyJS and found it not so bad at all. > The virtual machine loads on a few seconds (using firefox). > > It s really nice for learning Python, you have all the standard librarie

Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Hy all, I am experimenting PyPyJS and found it not so bad at all. The virtual machine loads on a few seconds (using firefox). It s really nice for learning Python, you have all the standard libraries, and traceback on errors. I don't have to choose anymore with all transpilers around You can t

Re: Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Thank you very much ast and all of you. I better understant now Regards -- https://mail.python.org/mailman/listinfo/python-list

Explaining names vs variables in Python (follow)

2016-03-02 Thread Salvatore DI DIO
Thank you very much all of you. I better understand now Regards -- https://mail.python.org/mailman/listinfo/python-list

Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Hello, I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior >>> b = 234 >>> v = 234 >>> b is v True according to the above that is ok But where is the consistency ? if I try : >>> v = 890 >>> w = 890 >>> v is w False It

Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-10 Thread Salvatore DI DIO
Thank you very much Peter -- https://mail.python.org/mailman/listinfo/python-list

Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Oscar, I was considering using Mapple :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Oscar,I was considerind using Mapple :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Chris -- https://mail.python.org/mailman/listinfo/python-list

Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Hello, I was trying to show that this limit was 'e' But when I try large numbers I get errors def lim(p): return math.pow(1 + 1.0 / p , p) >>> lim(5) 2.718281748862504 >>> lim(9) 2.7182820518605446 What am i doing wrong ? Regards -- https://mail.python.org/mailman/l

RapydBox

2014-02-04 Thread Salvatore DI DIO
Hello, For those of you who are interested by tools like NodeBox or Processing. you can give a try to RapydScript here : https://github.com/artyprog/RapydBox Regards -- https://mail.python.org/mailman/listinfo/python-list

Source code of Python to Javascsript translator

2013-11-18 Thread Salvatore DI DIO
> > I don't know about other people here, but I'm a bit leery of just > > downloading Windows binaries from people and running them. Is your > > source code available? Is this an open source / free project? > > > > ChrisA You are completly right :-) Here is the source code : https://github.com/c

Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Salvatore DI DIO
> > I don't know about other people here, but I'm a bit leery of just > > downloading Windows binaries from people and running them. Is your > > source code available? Is this an open source / free project? > > > > ChrisA You are completly right :-) Here is the source code : https://github

Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Are lists comprehensions are featured in Veloce ? -- https://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Porting Kivy would be really great. Le dimanche 17 novembre 2013 20:17:44 UTC+1, Amirouche Boubekki a écrit : > Héllo Pythonistas from all over the world, > > > > I'm very proud to announce the immediate availability of Pythonium Core > 0.2.5, a Python 3 to Javascript translator (the best) th

Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Thanks Amirouche, I am now balanced between RapydScript and Pythonium :-) Le dimanche 17 novembre 2013 20:17:44 UTC+1, Amirouche Boubekki a écrit : > Héllo Pythonistas from all over the world, > > > > I'm very proud to announce the immediate availability of Pythonium Core > 0.2.5, a Python 3

RapydScript : Python to Javascript translator

2013-11-17 Thread Salvatore DI DIO
Hello, If someone is interested about a fast Python to Javascript translator (not a compiler like Brython which is another beast) Here is a link of a RapydScript Tester. For now it's only for windows. Regards http://salvatore.pythonanywhere.com/static/Projects/RapydScriptDemo.exe (I can if t

Nodebox(v1) on the web via RapydScript

2013-10-03 Thread Salvatore DI DIO
Hello, Nodebox is a program in the spirit of Processing but for Python. The first version runs only on MAC. Tom, the creator has partly ported it to Javascript. But many of you dislike Javascript. The solution was to use a translator, Python -> Javascript Of the both two greats solutions Bryth

Re: Class.__class__ magic trick help

2012-08-21 Thread Massimo Di Pierro
Hello Oscar, thanks for your help but your proposal of adding: def __setitem__(self,key,value): self.__dict__[key] = value dict.__setitem__(self, key, value) does not help me. What I have today is a class that works like SlowStorage. I want to replace it with NewStorage because it is 10x

Re: Class.__class__ magic trick help

2012-08-21 Thread Massimo Di Pierro
On Aug 21, 2:40 am, Oscar Benjamin wrote: > On Mon, 20 Aug 2012 21:17:15 -0700 (PDT), Massimo Di Pierro > > > > > > > > > > wrote: > > Consider this code: > > class SlowStorage(dict): > >     def __getattr__(self,key): > >  

Re: Class.__class__ magic trick help

2012-08-20 Thread Massimo Di Pierro
Consider this code: class SlowStorage(dict): def __getattr__(self,key): return self[key] def __setattr__(self,key): self[key]=value class FastStorage(dict): def __init__(self, __d__=None, **kwargs): self.update(__d__,**kwargs) def __getitem__(self,key):

Re: Class.__class__ magic trick help

2012-08-20 Thread Massimo Di Pierro
, in File "", line 3, in __init__ TypeError: __class__ assignment: only for heap types On Aug 20, 1:39 pm, Ian Kelly wrote: > On Mon, Aug 20, 2012 at 12:01 PM, Massimo Di Pierro > > wrote: > > I discovered I can do this: > > >     class A(object): pass

Class.__class__ magic trick help

2012-08-20 Thread Massimo Di Pierro
I discovered I can do this: class A(object): pass class B(object): __class__ = A # magic b = B() isinstance(b,A) # returns True (as if B derived from A) isinstance(b,B) # also returns True I have some reasons I may want to do this (I an object with same methods a

Re: dynamic setattr

2012-07-27 Thread Mariano Di Felice
on concept, yeah! You all right! But I need a conversion class (as Utility) that expose getter/setter of any keys. Thx! Il giorno venerdì 27 luglio 2012 15:46:59 UTC+2, Steven D'Aprano ha scritto: > On Fri, 27 Jul 2012 05:49:45 -0700, Mariano Di Felice wrote: > > > Hi, > >

dynamic setattr

2012-07-27 Thread Mariano Di Felice
Hi, I have a property file (.ini) that has multiple sections and relative keys, as default structure. Now, I would like to export from my utility class methods getter and setter. I have started as is: class Utility: keys = {"STANDUP": ["st_key1", "st_key2", "st_key3", "st_key4"],

Re: __future__ and __rdiv__

2012-01-22 Thread Massimo Di Pierro
Thank you. I tried __rtruediv__ and it works. On Jan 23, 2012, at 12:14 AM, Ian Kelly wrote: > On Sun, Jan 22, 2012 at 10:22 PM, Massimo Di Pierro > wrote: > Hello everybody, > > I hope somebody could help me with this problem. If this is not the right > place to ask, pleas

__future__ and __rdiv__

2012-01-22 Thread Massimo Di Pierro
Hello everybody, I hope somebody could help me with this problem. If this is not the right place to ask, please direct me to the right place and apologies. I am using Python 2.7 and I am writing some code I want to work on 3.x as well. The problem can be reproduced with this code: # from __futu

Global variables in a C extension for Python

2011-12-28 Thread Lorenzo Di Gregorio
Hello, I've written a C extension for Python which works so far, but now I've stumbled onto a simple problem for which I just can't find any example on the web, so here I am crying for help ;-) I'll trying to reduce the problem to a minimal example. Let's say I need to call from Python functions

Twisted Perspective Broker: get client ip

2011-09-14 Thread Andrea Di Mario
= checkers.FilePasswordDB('passwords.txt', caseSensitive=True, cache=True) p.registerChecker(c) factory = pb.PBServerFactory(p) reactor.listenSSL(int(PORT), factory, myContextFactory) reactor.run() -- Andrea Di Mario -- http://mail.python.org/mailman/listinfo/python-list

Notifications when process is killed

2011-08-02 Thread Andrea Di Mario
e signal > number that caused the termination; you can then log anything you > want. Hi, i understand, i've read that SIGKILL can't catch, but nothing about SIGTERM. If i use SIGCHLD, i will have difficult when parent receive a SIGTERM, or not? Thanks, regards. -- Andrea Di

Notifications when process is killed

2011-08-01 Thread Andrea Di Mario
Thanks Thomas, it is what i'm looking for. Regards -- Andrea Di Mario -- http://mail.python.org/mailman/listinfo/python-list

Notifications when process is killed

2011-08-01 Thread Andrea Di Mario
to do this? Thanks, regards. -- Andrea Di Mario -- http://mail.python.org/mailman/listinfo/python-list

Secure ssl connection with wrap_socket

2011-07-05 Thread Andrea Di Mario
r: urllib2.URLError: It works only with CERT_NONE (the default) but with this option i could access to the service in insicure mode. Have you some suggestions for my service? Thanks. Regards. -- Andrea Di Mario -- http://mail.python.org/mailman/listinfo/python-list

How to print zero-padded floating point numbers in python 2.6.1

2009-11-04 Thread Lorenzo Di Gregorio
Hello, I thought that I could zero-pad a floating point number in 'print' by inserting a zero after '%', but this does not work. I get: print '%2.2F' % 3.5 3.50 print '%02.2F' % 3.5 3.50 How can I get print (in a simple way) to print 03.50? Best Regards, Lorenzo -- http://mail.python.org/mail

Re: Frameworks

2009-10-20 Thread Massimo Di Pierro
On Oct 20, 2009, at 4:59 PM, Emmanuel Surleau wrote: Compared to custom tags in, say, Mako? Having to implement a mini- parser for each single tag when you can write a stupid Python function is needless complication. I like Mako a lot and in fact web2py template took some inspiration from

Re: Frameworks

2009-10-20 Thread Massimo Di Pierro
> So does web2py allow for raw sql if there is an advanced procedure or query that needs to be performed that is outside the scope of the web2pr orm Yes db.executesql("whatever you want") http://www.web2py.com/examples/static/epydoc/web2py.gluon.sql.SQLDB-class.html Massimo -- http://mail.

Re: Frameworks

2009-10-19 Thread Massimo Di Pierro
Hello, Just to clarify. I did not make any statement about "web2py is superior to SQLAlchemy" since that is somewhat subjective. SQLALchemy for example does a much better job at accessing legacy databases. web2py is more limited in that respect and we are working on removing those limitatio

Re: Using freeze.py's output and compiling in Windows

2009-09-10 Thread Di Biase, Paul A CIV NAVAIR, 4.4
No one? -- http://mail.python.org/mailman/listinfo/python-list

Using freeze.py's output and compiling in Windows

2009-09-10 Thread Di Biase, Paul A CIV NAVAIR, 4.4
I have learned python (and wxpython) over the past year and it has taken over every other language in my work environment for almost every task (langs: matlab, VBA, fortran...yes fortran, c++, more too...). My main concern has always been distribution of software over our internal networked compu

Re: Inheritance and forward references (prototypes)

2009-06-22 Thread Lorenzo Di Gregorio
On 21 Jun., 22:51, Scott David Daniels wrote: > LorenzoDiGregoriowrote: > > On 21 Jun., 01:54, Dave Angel wrote: > >> ... > >> class B(object): > >>     def __init__(self,test=None): > >>         if test==None: > >>             test = A() > >>         self.obj =() > >>         return > > ... > >

  1   2   >