Re: Python 3.8 or later on Debian?

2024-09-18 Thread Alexander Neilson via Python-list
the past I did build newer Python versions (mostly on raspberry pi’s) Regards Alexander Alexander Neilson Neilson Productions Limited 021 329 681 alexan...@neilson.net.nz > On 19 Sep 2024, at 10:42, Ulrich Goebel via Python-list > wrote: > > Hi, > > Debian Linux seems

Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Alexander Nestorov
I'm working on an NLP and I got bitten by an unreasonably slow behaviour in Python while operating with small amounts of numbers. I have the following code: ```python import random, time from functools import reduce def trainPerceptron(perceptron, data):   learningRate = 0.002   weights = perce

Possible re bug when using ".*"

2022-12-28 Thread Alexander Richert - NOAA Affiliate via Python-list
? Perhaps relatedly, I noticed that even in 3.6, the code print(re.findall(".*","pattern")) yields ['pattern',''] which is not what I was expecting. Thanks, Alex Richert -- Alexander Richert, PhD *RedLine Performance Systems* -- https://mail.python.org/mailman/listinfo/python-list

Re: How Do I Get A Bug In Multiprocessing Fixed?

2021-06-17 Thread Alexander Neilson
;No connection could be made because the target machine actively refused it', None, 10061, None) Reconnecting Traceback (most recent call last): File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\multiprocessing\connection.py", line 619, in SocketClient s.connect(address

Re: strip() method makes me confused

2020-11-07 Thread Alexander Neilson
containing comma) returns false so it stops searching from that end and does the same at the other end. https://www.programiz.com/python-programming/methods/string/strip Hope that helps. Regards Alexander Alexander Neilson Neilson Productions Limited 021 329 681 alexan...@neilson.net.nz

Re: Pycharm Won't Do Long Underscore

2020-06-23 Thread Alexander Neilson
-methods Happy to have helped and good luck with your Python journey. Regards Alexander Alexander Neilson Neilson Productions Limited 021 329 681 alexan...@neilson.net.nz > On 24/06/2020, at 08:49, Tony Kaloki wrote: > >  > Alexander, >Thank you so much! It wo

Re: Pycharm Won't Do Long Underscore

2020-06-23 Thread Alexander Neilson
ore. Regards Alexander Alexander Neilson Neilson Productions Limited 021 329 681 alexan...@neilson.net.nz > On 24/06/2020, at 07:57, Tony Kaloki wrote: > >  > > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 > > From: Tony Kaloki<

Mouse control

2019-10-06 Thread Alexander Vergun
opened by the script only then the script controls the mouse. I tried to call win32gui.SetCapture without any effect. Does anyone have an idea how to handle this? Thank you very much, Alexander -- Ing. Alexander Vergun tel.: +421905167381 -- https://mail.python.org/mailman/listinfo/python-list

EuroSciPy 2019 - CfP is open

2019-04-02 Thread Alexander CS Hendorf [EuroSciPy 2019]
= *** Apologise for multiple posting *** Dear Colleagues, We are delighted to invite you to join us for the 12th European Conference on Python in Science. The EuroSciPy 2019 Conference will take place from September 2 to September 6 in Bilba

(yet another) PEP idea to tackle binary wheels problem efficiently

2019-02-18 Thread Alexander Revin
Hi all, I've been thoroughly reading various discussions, such as [1], [2] and related ones regarding PEP 425, PEP 491 and PEP 513. I also happen to use musl sometimes, so as discussed here [3] I thought it would be a good idea to submit a new PEP regarding musl compatibility. It's not a secret t

Re: (yet another) PEP idea to tackle binary wheels problem efficiently

2019-02-18 Thread Alexander Revin
Two minor typos: platform tag should be separated by "-", not "_". Also it makes sense to use "amd64" instead of "x86_64", so platform can be just split by "_" On Sat, Feb 16, 2019 at 9:29 PM Alexander Revin wrote: > > Hi all, > > I&#

EuroPython 2018: First list of accepted sessions available

2018-05-31 Thread Alexander C. S. Hendorf
Team https://ep2018.europython.eu/ https://www.europython-society.org/ Alexander Hendorf as EuroPython vice chair & chair of the program work group Twitter: @hendorf LinkedIn: https://www.linkedin.com/in/hendorf EuroPython: https://www.europython.eu/ https://twitter.com/europython h

PyConDE 2018 (Germany) & PyData Karlsruhe CfP extended.

2018-05-28 Thread Alexander CS Hendorf [PyConDE 2018]
on.org/blog/fin-aid/ <https://de.pycon.org/blog/fin-aid/> Please familiarise yourself with the conference code of conduct https://de.pycon.org/code-of-conduct/ <https://de.pycon.org/code-of-conduct/> Alexander Hendorf @hendorf as PyConDE & PyData Karlsruhe 2018 program chair & or

Generating list of rsquared_adj regression values for variating i with loop

2018-04-18 Thread Alexander Hempfing via Python-list
Dear all, I am wondering if someone could please help me with an issue I am currently trying to solve: I have a "static" code which looks as follows: tsd_res_fra_08 =res_fra_08['D_Cummulative'][100] tsd_res_fra_09 =res_fra_09['D_Cummulative'][100] tsd_res_fra_10 =res_fra_10['D_Cummulative'][10

EuroPython 2017 Keynote: Aisha Bello & Daniele Procida

2017-05-22 Thread Alexander Hendorf
We are pleased to announce our next keynote speakers for EuroPython 2017: ** Aisha Bello & Daniele Procida ** About Aisha Aisha currently serves as vice chair for the Python Nigeria community. She has helped co-organized and support a number of Django

EuroPython 2017 Keynote: Katharine Jarmul

2017-05-19 Thread Alexander Hendorf
We are pleased to announce our next keynote speaker for EuroPython 2017: * Katharine Jarmul * About Katharine Jarmul Katharine Jarmul is a pythonista and founder of Kjamistan, a data consulting company in Berlin, Germany. She’s been using P

EuroPython 2017 Keynote: Armin Ronacher

2017-05-12 Thread Alexander Hendorf
We are pleased to announce our next keynote speaker for EuroPython 2017: * Armin Ronacher * About Armin Ronacher Armin Ronacher has founded a number of Python open source projects. Most notably, he is the creator of Flask, a popular

EuroPython 2017: Tickets are now available

2017-04-07 Thread Alexander Hendorf
You can now buy regular tickets for Europe’s largest Python conference. After the early bird tickets sold out in just eight hours, standard rate tickets are now available: Student: EUR 130.- incl. VAT (only available for students and postdocs; please bring your student card) Personal: EUR 375.

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread Alexander N. Moibenko
On 09/08/2016 12:19 PM, Chris Angelico wrote: On Fri, Sep 9, 2016 at 2:50 AM, Alexander N. Moibenko wrote: The output is long so, I am replying to you only: Not too long, fortunately. Replying back to the list with a trimmed version. make[1]: Entering directory `/opt/enstore/src

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread Alexander N. Moibenko
On 09/08/2016 11:06 AM, Rustom Mody wrote: On Thursday, September 8, 2016 at 8:57:23 PM UTC+5:30, Alexander N. Moibenko wrote: Yes this Linux Red Hat 6. [enstore@dmsen02 enstore-log]$ cat /etc/redhat-release Scientific Linux Fermi release 6.5 (Ramsey) Please note that the same set of

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread Alexander N. Moibenko
wrote: On Fri, Sep 9, 2016 at 12:48 AM, Alexander N. Moibenko wrote: In fact I tried issuing commands manually, but they did not give me any hint more than I already had. In python 2.6 this all works with the same libc, of course (because I tried to compile on the same machine). Can you

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread Alexander N. Moibenko
In fact I tried issuing commands manually, but they did not give me any hint more than I already had. In python 2.6 this all works with the same libc, of course (because I tried to compile on the same machine). Thanks anyway. On 09/08/2016 01:22 AM, dieter wrote: "Alexander N. Moi

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread Alexander N. Moibenko
Finney wrote: "Alexander N. Moibenko" writes: /opt/python/Python-2.7.12/./Modules/posixmodule.c:7578: warning: the use of `tempnam' is dangerous, better use `mkstemp' collect2: ld returned 1 exit status How this can be fixed? The clearest answer is already there in the warn

Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-07 Thread Alexander N. Moibenko
e of `tempnam' is dangerous, better use `mkstemp' collect2: ld returned 1 exit status How this can be fixed? Thanks, Alexander -- https://mail.python.org/mailman/listinfo/python-list

(Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop

2016-04-08 Thread Alexander Myodov
so, won't the previous event loop miss any its events? Thank you in advance. Alexander -- https://mail.python.org/mailman/listinfo/python-list

Re: Installing ibm_db package on Windows 7, 64-bit problem

2016-03-10 Thread Alexander Shmugliakov
On Thursday, March 10, 2016 at 10:09:26 AM UTC+2, Chris Angelico wrote: > On Thu, Mar 10, 2016 at 6:46 PM, Alexander Shmugliakov > wrote: > > Hello, has anybody successfully installed ibm_db package in the 32-bit > > Python 3.5.0 environment? This is the error messages I'

Installing ibm_db package on Windows 7, 64-bit problem

2016-03-09 Thread Alexander Shmugliakov
Hello, has anybody successfully installed ibm_db package in the 32-bit Python 3.5.0 environment? This is the error messages I'm receiving: I know that the message about vcvarsall.bat is related to the Visual Studio configuration -- I don't have it on my computer. I have no 64-bit IBM Data Server

UNABLE TO GET IDLE TO RUN

2015-10-22 Thread Terry Alexander via Python-list
Hello... I have tried installing both Python 2.7 and 3.5, and in both cases I cannot get IDLE to work. I received the following message both times: IDLE’s subprocess didn’t make connection.  Either IDLE can’t start a subprocess or personalfirewall software is blocking the connection. I am running

Re: Adding PEP 495 support to dateutil

2015-09-19 Thread Alexander Belopolsky
[Tim Peters] > > I think acceptance of 495 should be contingent upon > someone first completing a fully functional (if not releasable) > fold-aware zoneinfo wrapping. [Alexander Belopolsky] > > I am making all development public early on and hope to see code reviews and

Adding PEP 495 support to dateutil

2015-09-16 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 9:58 PM, Tim Peters wrote: > I think acceptance of 495 should be contingent upon > someone first completing a fully functional (if not releasable) > fold-aware zoneinfo wrapping. > After studying both pytz and dateutil offerings, I decided that it is easier to add "fold-a

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 4:22 PM, Tim Peters wrote: > > faster > > than CPython can look up the .utcoffset method. (At least for times > > within a few years around now.) A programmer who makes it slower should > > be fired. > > So any programmer who implements .utcoffset() in Python should be > f

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 3:49 PM, Tim Peters wrote: > It depends on how expensive .utcoffset() > is, which in turn depends on how the tzinfo author implements it. > No, it does not. In most time zones, UTC offset in seconds can be computed by C code as a 4-byte integer faster than CPython can lo

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 3:44 PM, Random832 wrote: > It is an > invariant that is true today, and therefore which you can't rely on any > of the consumers of this 12 years old widely deployed code not to assume > will remain true. > Sorry, this sentence does not parse. You are missing a "not" so

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 4:08 PM, Random832 wrote: > On Mon, Sep 14, 2015, at 15:48, Alexander Belopolsky wrote: > > On Mon, Sep 14, 2015 at 3:44 PM, Random832 > > wrote: > > > > > It is an > > > invariant that is true today, and therefore which you can&

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 3:13 PM, Random832 wrote: > (No, I don't > *care* how that's not how it's defined, it is *in fact* true for the UTC > value that you will ever actually get from converting the values to UTC > *today*, and it's the only total ordering that actually makes any sense) > This

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Mon, Sep 14, 2015 at 3:30 PM, Tim Peters wrote: > > make it much cheaper to maintain global invariants like a sort order > > according to the UTC value > > It would be nice to have! .utcoffset() is an expensive operation > as-is, and being able to rely on tm_gmtoff would make that dirt-cheap

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Alexander Belopolsky
On Sun, Sep 13, 2015 at 6:21 PM, Guido van Rossum wrote: > > Now, the question may remain how do people know what to set their timezone to. But neither pytz nor datetime can help with that -- it is up to the sysadmin. Note that this question is also out of the scope of "tzdist", IETF Time Zone D

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-13 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 10:25 PM, Tim Peters wrote: > > I will try to create a zoneinfo wrapping prototype as well, but I will > > probably "cheat" and build it on top of pytz. > > It would be crazy not to ;-) Note that Stuart got to punt on "the > hard part": .utcoffset(), since pytz only use

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-13 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 6:24 PM, Guido van Rossum wrote: > The repeated claims (by Alexander?) that astimezone() has the power of > pytz's localize() need to stop. Prove me wrong! :-) > Those pytz methods work for any (pytz) timezone -- astimezone() with a > default argume

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-13 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 9:58 PM, Tim Peters wrote: > > That's why I believe PEP 495 followed by the implementation > > of fold-aware "as intended" tzinfos (either within stdlib or by third > > parties) is the right approach. > > Me too - except I think acceptance of 495 should be contingent upon

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 4:10 PM, Tim Peters wrote: > "A potential problem" with .astimezone()'s default is that it _does_ > create a fixed-offset zone. It's not at all obvious that it should do > so. First time I saw it, my initial _expectation_ was that it > "obviously" created a hybrid tzinfo

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Alexander Belopolsky
On Sat, Sep 12, 2015 at 3:41 PM, Tim Peters wrote: > > If there are not, maybe the intended semantics should go > > by the wayside and be replaced by what pytz does. > > Changing anything about default arithmetic behavior is not a > possibility. This has been beaten to death multiple times on th

Re: Converting 5.223701009526849e-05 to 5e-05

2015-05-07 Thread Alexander Blinne
Am 03.05.2015 um 10:48 schrieb Ben Finney: > That's not as clear as it could be. Better is to be explicit about > choosing “exponential” format:: > > >>> foo = 5.223701009526849e-05 > >>> "{foo:5.0e}".format(foo=foo) > '5e-05' > Or even better the "general" format, which also works f

Re: [OT] Weaknesses of distro package managers - was Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Alexander
Hi all, Surely you did not look at the package manager and package assortment of OpenBSD. It is actually a really good example of how package repository can be both reliable, easy to use and up to date. Also, what sort of quality can be expected from a piece of software, whose author is unable t

Re: Assigning a function to sys.excepthook doesn't work in WSGI

2015-02-18 Thread Alexander Sh
On Wednesday, February 18, 2015 at 7:52:19 PM UTC+3, Ian wrote: > > sys.excepthook is called just before the interpreter exits due to an > exception. In a mod_wsgi environment, having the interpreter exit just > because of an exception would be undesirable. I don't know exactly > what it's doing u

Re: set environmental variable from python

2014-11-01 Thread Alexander Blinne
Am 31.10.2014 um 02:22 schrieb Artur Bercik: > I have to set environmental variable in my windows PC as follows: > > variable name: GISBASE > > value: C:\GRASS-64 > > Is it possible to set it from python? > > import sys > > sys.path.append("C:\\GRASS-64") > > But how to give variable name? I

Re: Issue in printing top 20 dictionary items by dictionary value

2014-10-04 Thread Alexander Blinne
through the text. The get-method has a keyword argument for creating default values, which might be useful here. Another thing worth of mentioning is, that python has exactly this kind of machinery already built-in (collections.Counter), but you should try and implement a simple version of it yourself as exercise. Alexander -- https://mail.python.org/mailman/listinfo/python-list

python-list@python.org

2014-08-03 Thread Alexander Williams
I want to break a PKCS7 signature that contains data + signature into separate: raw data & detached PKCS7 signature in python. I can get the data fro the signature because the verification routine returns it, but how can I get the detached signature ? def verify_pkcs7(data_bio, signature_bio, c

Re: Kivy contest 2014

2014-03-19 Thread Alexander Taylor
The theme will be announced when the contest officially starts, the 15th April. On Wednesday, 19 March 2014 09:27:14 UTC, audiowerk wrote: > > Hi! > > Is there already a date when the theme will be announced? > > Am Sonntag, 16. März 2014 18:42:16 UTC+1 schrieb qua-non: >> >> Hi folks, >> >> Kivy

Re: Reference

2014-03-04 Thread Alexander Blinne
Am 04.03.2014 15:06, schrieb Chris Angelico: > https://github.com/Rosuav/ExceptExpr/blob/master/find_except_expr.py I have always found it quite nice that the python parser is so easy to use from within python itself. > Run across the Python stdlib, that tells me there are 4040 uses of > is/is no

Re: Reference

2014-03-04 Thread Alexander Blinne
Am 03.03.2014 19:48, schrieb Terry Reedy: > The 'is' operator has three uses, two intended and one not. In > production code, 'is' tests that an object *is* a particular singular > object, such as None or a sentinel instance of class object. Just a bit of statistics on this one from a recent small

Re: Can I iterate over a dictionary outside a function ?

2013-04-11 Thread Alexander Blinne
Am 11.04.2013 11:48, schrieb inshu chauhan: > I have a prog in which a functions returns a dict but when I try to > iterate over the dict using iterkeys, It shows an error. 1) Show us your code in form of a minimal "working" example, "working" means that it should show us what you expect it to do

Re: iterating over a list as if it were a circular list

2013-03-07 Thread Alexander Blinne
Am 08.03.2013 00:49, schrieb Alexander Blinne: > http://docs.python.org/3/library/itertools.html#itertools.repeat obviously I was aiming for http://docs.python.org/2/library/itertools.html#itertools.cycle here Greetings -- http://mail.python.org/mailman/listinfo/python-list

Re: iterating over a list as if it were a circular list

2013-03-07 Thread Alexander Blinne
Am 07.03.2013 10:27, schrieb Sven: > Now I would like to iterate over P and place one N at each point. > However if you run out of N I'd like to restart from N[0] and carry on > until all the points have been populated. > So far I've got (pseudo code) > > i = 0 > for point in points: > put N[i

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Alexander Blinne
unsigned int n; the program runs in 0.68 sec instead of 0.79, so there is some shortcut. If changed into signed int n; there is a veeery long, perhaps infinite loop. Greetings Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Alexander Blinne
t n; int count; int num; while(m<=100) { m++; n = m; count = 0; while(n != 1) { count++; if(n % 2 == 0) { n = n / 2; } else { n = n*3 + 1; } } if(count > max) { max = count; num = m; } } printf(&quo

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-24 Thread Alexander Blinne
bus) scheduler.do_things() if __name__=="__main__": main() Please feel free to ask specific questions about this approach. merry christmas everyone Alexander Blinne -- http://mail.python.org/mailman/listinfo/python-list

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-22 Thread Alexander Blinne
Am 22.12.2012 21:43, schrieb prilisa...@googlemail.com: > I Think I describe my Situation wrong, the written Project is a > Server, that should store sensor data, perfoms makros on lamps according > a sequence stored in the DB and Rule systems schould regulate home devices > and plan scheduler job

Python, email temperature

2012-12-22 Thread Alexander Ranstam
call last): File "sendcpu.py", line 36, in msg = cpu_temperature NameError: name 'cpu_temperature' is not defined Does anyone know why the program claims that cpu_temperature isnt defined, when it is? Thanx! //Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-22 Thread Alexander Blinne
Am 22.12.2012 19:10, schrieb prilisa...@googlemail.com: > It's for me a view of top side down, but how could the midlevel comunicate to > each oter... "not hirachical" You could use something like the singleton pattern in order to get a reference to the same datastore-object every time Datastore.

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-22 Thread Alexander Blinne
Am 22.12.2012 13:45, schrieb prilisa...@googlemail.com: > Ps.: The Socket, the DB has to be kept allways open, because of it's Server > functionality, A lot of Sensors, Timers, User interaction, must recived , > Calculated, etc so a reaction must be send in about 16~100 ms, different > modules o

Re: Pattern-match & Replace - help required

2012-12-19 Thread Alexander Blinne
Am 19.12.2012 14:41, schrieb AT: > Thanks a million > Can you recommend a good online book/tutorial on regular expr. in python? http://docs.python.org/3/howto/regex.html -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Alexander Blinne
Am 18.12.2012 13:37, schrieb Jean Dubois: > I have trouble with the code beneath to make an array with equally > spaced values > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > get the following result: > [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] > But I was hop

Re: Preventing tread collisions

2012-12-13 Thread Alexander Blinne
Am 12.12.2012 21:29, schrieb Dave Angel: > On 12/12/2012 03:11 PM, Wanderer wrote: >> I have a program that has a main GUI and a camera. In the main GUI, you can >> manipulate the images taken by the camera. You can also use the menu to >> check the camera's settings. Images are taken by the came

Re: Python Noob Question.

2012-12-10 Thread Alexander Blinne
on't know how to make it 'query' or grab values constantly, if you don't > mind my potentially incorrect terminology. This is typically done with some kind of loop, e.g. run = True while run: #do something repeatedly and do "run = False" if you want to stop pass Greetings Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-06 Thread Alexander Blinne
Am 05.12.2012 18:04, schrieb Nick Mellor: > Sample data Well let's see what def split_product(p): p = p.strip() w = p.split(" ") try: j = next(i for i,v in enumerate(w) if v.upper() != v) except StopIteration: return p, '' return " ".join(w[:j]), " ".join(w[j:]

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Am 04.12.2012 20:37, schrieb Ian Kelly: > >>> def split_product(p): > ... w = p.split(" ") > ... j = next(i for i,v in enumerate(w) if v.upper() != v) > ... return " ".join(w[:j]), " ".join(w[j:]) > > > It still fails if the product description is empty. That's true..

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Am 04.12.2012 19:28, schrieb DJC: (i for i,v in enumerate(w) if v.upper() != v).next() > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'generator' object has no attribute 'next' Yeah, i saw this problem right after i sent the posting. It now is supposed to read

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Alexander Blinne
Another neat solution with a little help from http://stackoverflow.com/questions/1701211/python-return-the-index-of-the-first-element-of-a-list-which-makes-a-passed-fun >>> def split_product(p): ... w = p.split(" ") ... j = (i for i,v in enumerate(w) if v.upper() != v).next() ... retu

Re: Conversion of List of Tuples

2012-12-04 Thread Alexander Blinne
Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: > Dear Group, > > I have a tuple of list as, > > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > > list=[1,2,3,4] > > how may I do that? Another approach that has not yet been mentioned here: >>> a=[(1,2), (3,4)] >>>

Re: Python Noob Question.

2012-12-03 Thread Alexander Blinne
Hello, by having a quick look at their website i found a plugin for CoreTemp which acts as a server and can be asked for status information of the cpu. Now your task is really simple: write a little function or class that opens a network socket, connects to that plugin und asks it for the informat

Re: creating size-limited tar files

2012-11-07 Thread Alexander Blinne
I don't know the best way to find the current size, I only have a general remark. This solution is not so good if you have to impose a hard limit on the resulting file size. You could end up having a tar file of size "limit + size of biggest file - 1 + overhead" in the worst case if the tar is at l

Re: write binary with struct.pack_into

2012-10-06 Thread Alexander Blinne
First, you should consider reading the documentation of struct.unpack_from and struct.pack_into at http://docs.python.org/library/struct.html quite carefully. It says, that these commands take a parameter called offset, which names the location of the data in a buffer (e.g. an opened file). exampl

Re: Functional way to compare things inside a list

2012-09-21 Thread Alexander Blinne
On 21.09.2012 00:58, thorso...@lavabit.com wrote: > Hi, > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] > > I want to check for a value (e.g. '4'), and get the key of the dictionary > that contains that value. > (Yep, this is bizarre.) > > some_magic(list, '4') > => '3' > > What's the func

Re: Python presentations

2012-09-17 Thread Alexander Blinne
On 16.09.2012 19:35, Steven D'Aprano wrote: > On Sun, 16 Sep 2012 18:13:36 +0200, Alexander Blinne wrote: >> def powerlist2(x,n): >> if n==1: >> return [1] >> p = powerlist3(x,n-1) >> p.append(p[-1]*x) >> return p > > Is

Re: Python presentations

2012-09-16 Thread Alexander Blinne
On 14.09.2012 14:19, Chris Angelico wrote: > Err, yes, I did mean ** there. The extra multiplications may be > slower, but which is worse? Lots of list additions, or lots of integer > powers? In the absence of clear and compelling evidence, I'd be > inclined to go with the list comp - and what's mo

Re: Python presentations

2012-09-14 Thread Alexander Blinne
On 14.09.2012 00:38, Chris Angelico wrote: > On Fri, Sep 14, 2012 at 8:33 AM, Alexander Blinne wrote: >> def powerlist(x,n): >> if n==1: >> return [1] >> p = powerlist(x,n-1) >> return p + [p[-1]*x] > > Eh, much simpler. > >

Re: Python presentations

2012-09-13 Thread Alexander Blinne
On 13.09.2012 21:01, 8 Dihedral wrote: > def powerlist(x, n): > # n is a natural number > result=[] > y=1 > for i in xrange(n): > result.append(y) > y*=x > return result # any object in the local function can be returned def powerlist(x, n): result=

Re: issue with struct.unpack

2012-08-26 Thread Alexander Blinne
On 26.08.2012 01:31, Dennis Lee Bieber wrote: > The struct module relies upon the user knowing the format of the data. > If your problem is that you have some null-terminated string data in a > variable width field, you will have to locate the position of the null > FIRST, and specify the appropria

Re: Objects in Python

2012-08-24 Thread Alexander Blinne
On 23.08.2012 20:30, Dennis Lee Bieber wrote: > On Thu, 23 Aug 2012 15:33:33 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: >> x = 1; >> >> In C, this means: Assign the integer 1 to the variable x (possibly >> with implicit type casting, eg to floating point). >> >

Re: [CGI] Why is HTML not rendered?

2012-08-17 Thread Alexander Blinne
On 17.08.2012 15:27, Gilles wrote: > For some reason, this CGI script that I found on Google displays the > contents of the variable but the HTML surrounding it is displayed > as-is by the browser instead of being rendered: > print "Content-Type: text/plain;charset=utf-8" With this line you tell

Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-24 Thread Alexander Serebrenik
As a scientist I would be more than happy to publish in Open-Access Journals rather than in IEEE/ACM/Springer-published ones. However, I also have to be sure that my publications reach the scientific community and make an impact on it. Unfortunately, in many fields AFAIK the better journals (= h

Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-23 Thread Alexander Serebrenik
1) The paper referenced contains 4 pages, so it should be available via IEEXplore. Moreover, you can find a copy on http://www.win.tue.nl/~aserebre/MSR2012.pdf 2) Since the survey is only one of the techniques we intend to use, and it will be augmented by analysing the data publicly available i

Gender, Representativeness and Reputation in StackOverflow

2012-07-23 Thread Alexander Serebrenik
ndrea Capiluppi (andrea.capiluppi @ brunel.ac.uk) [Lecturer, Brunel University, UK; NL; SO userid: 1528556] Alexander Serebrenik (a.serebrenik @ tue.nl) [Assistant Professor, Eindhoven University of Technology, NL; SO userid: 1277111] Bogdan Vasilescu (b.n.vasilescu @ tue.nl) [PhD student, Eind

Re: 2 + 2 = 5

2012-07-05 Thread Alexander Blinne
On 05.07.2012 16:34, Laszlo Nagy wrote: five.contents[five.contents[:].index(5)] = 4 5 > 4 5 is 4 > True That's surprising, because even after changing 5 to 4 both objects still have different id()s (tested on Py2.7), so 5 is 4 /should/ still be False (But isn't on my 2.7). But that

Re: Python equivalent to the "A" or "a" output conversions in C

2012-06-19 Thread Alexander Blinne
On 19.06.2012 18:23, Edward C. Jones wrote: > Consider the following line in C: >printf('%a\n', x); > where x is a float or double. This outputs a hexadecimal representation > of x. Can I do this in Python? Don't know why there is no format character %a or %A in python, but the conversion is

Re: which one do you prefer? python with C# or java?

2012-06-15 Thread Alexander Blinne
On 15.06.2012 09:00, Paul Rubin wrote: > Alexander Blinne writes: >>> def gen_s(): >>> s = [1] >>> m = skipdups(heapq.merge(*[(lambda j: (k*j for k in s))(n) for n in >>> [2,3,5]])) >>> yield s[0] >>> while True: >>>

Re: which one do you prefer? python with C# or java?

2012-06-11 Thread Alexander Blinne
On 10.06.2012 23:27, Paul Rubin wrote: > Here is an exercise from the book that you might like to try in Python: > > http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-24.html#%_idx_3894 > > It's not easy ;-) I liked this exercize. At first I wrote my own merger. > def merge(*iterables): >

Re: why () is () and [] is [] work in other way?

2012-04-23 Thread Alexander Blinne
Am 21.04.2012 14:51, schrieb gst: > Hi, > > I played (python3.2) a bit on that and : > > case 1) Ok to me (right hand side is a tuple, whose elements are evaluated > one per one and have same effect as your explanation (first [] is destroyed > right before the second one is created) : > x

Re: why () is () and [] is [] work in other way?

2012-04-21 Thread Alexander Blinne
Am 21.04.2012 05:25, schrieb Rotwang: > On 21/04/2012 01:01, Roy Smith wrote: >> In article<877gxajit0@dpt-info.u-strasbg.fr>, >> Alain Ketterlin wrote: >> >>> Tuples are immutable, while lists are not. >> >> If you really want to have fun, consider this classic paradox: >> > [] is [] >>

Re: Zipping a dictionary whose values are lists

2012-04-13 Thread Alexander Blinne
Am 12.04.2012 18:38, schrieb Kiuhnm: > Almost. Since d.values() = [[1,2], [1,2,3], [1,2,3,4]], you need to use > list(zip(*d.values())) > which is equivalent to > list(zip([1,2], [1,2,3], [1,2,3,4])) > > Kiuhnm While this accidently works in this case, let me remind you that d.values() do

Re: Documentation, assignment in expression.

2012-03-25 Thread Alexander Blinne
I am not sure I understand your argument. The doc section states that " [...] in Python you’re forced to write this: while True: line = f.readline() if not line: break ... # do something with line". That simply isn't true as one can simply write: for line in f: #do s

Documentation, assignment in expression.

2012-03-23 Thread Alexander Blinne
e this: > while True: > line = f.readline() > if not line: > break > ... # do something with line I think at least we need a new example. Any ideas? Greetings Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: Python recursive tree, linked list thingy

2012-03-07 Thread Alexander Blinne
Am 07.03.2012 20:49, schrieb Wanderer: I have a list of defective CCD pixels and I need to find clusters where a cluster is a group of adjacent defective pixels. This seems to me to be a classic linked list tree search.I take a pixel from the defective list and check if an adjacent pixel is in th

Re: Spamming PyPI with stupid packages

2012-01-01 Thread Alexander Kapps
Uh oh, should I really send this? ... Yes. Yes, I should! Sorry, I cannot resists. allow everyone to do "import girlfriend" I'm betting on a joke, like antigravity only significantly less funny and more sexist. Absolutely not funny. I hope that someday people will understand that sexism i

Re: Python education survey

2011-12-31 Thread Alexander Kapps
On 01.01.2012 03:36, Grant Edwards wrote: On 2011-12-31, Alexander Kapps wrote: On 31.12.2011 19:23, Roy Smith wrote: Why do I waste my time reading your pretentious self-important nonsense? http://xkcd.com/386/ ;) Why ROFLMAO when double-plus funny works just as well? xkcd/386 has

Re: python curses wrapper

2011-12-31 Thread Alexander Kapps
On 31.12.2011 20:34, Alexander Kapps wrote: On 31.12.2011 20:24, Mag Gam wrote: Hello, I have been struggling reseting the terminal when I try to do KeyboardInterrupt exception therefore I read the documentation for curses.wrapper and it seems to take care of it for me, http://docs.python.org

Re: python curses wrapper

2011-12-31 Thread Alexander Kapps
On 31.12.2011 20:24, Mag Gam wrote: Hello, I have been struggling reseting the terminal when I try to do KeyboardInterrupt exception therefore I read the documentation for curses.wrapper and it seems to take care of it for me, http://docs.python.org/library/curses.html#curses.wrapper. Can someo

Re: .format vs. %

2011-12-31 Thread Alexander Kapps
On 31.12.2011 19:44, davidfx wrote: Thanks for your response. I know the following code is not going to be correct but I want to show you what I was thinking. formatter = "%r %r %r %r" print formatter % (1, 2, 3, 4) What is the .format version of this concept? formatter = "{0} {1} {2} {3}

Re: Python education survey

2011-12-31 Thread Alexander Kapps
On 31.12.2011 19:23, Roy Smith wrote: Why do I waste my time reading your pretentious self-important nonsense? http://xkcd.com/386/ ;) Why ROFLMAO when double-plus funny works just as well? xkcd/386 has been the excuse for replying to RR for ages and I still don't understand why he gets

  1   2   3   4   5   6   >