On Tuesday, November 6, 2018 at 7:19:09 PM UTC-8, Terry Reedy wrote:
> On 11/6/2018 9:30 PM, j...y@it.u wrote:
>
> > b = i.to_bytes(1, "big")
> >
> >Is there another function which provides a more logical interface to this
> >straightforward task?
>
> Yes
> >>> 33 .to_bytes(1, 'big')
> b'!'
>
I'm using Python 3.6. I have a need to convert several small integers into
single bytes. As far as I can tell from reading through the Python docs, the
correct way to accomplish this task is:
b = i.to_bytes(1, "big")
This seems to work, but I find it cumbersome. I have to supply the byteorde
On Friday, September 28, 2018 at 11:03:17 AM UTC-7, Chris Green wrote:
> I have a list created by:-
>
> fld = shlex.split(ln)
>
> It may contain 3, 4 or 5 entries according to data read into ln.
> What's the neatest way of setting the fourth and fifth entries to an
> empty string if they don'
On Wednesday, September 19, 2018 at 2:00:13 PM UTC-7, Singamaneni Saikiran
wrote:
> It was showing some error please help me with a reply to solve this.
>
> saikiran
What code did you try? What error did you receive? And finally, what
operating system are you using?
--
https://mail.python.or
On Friday, July 20, 2018 at 2:00:26 AM UTC-7, Brian Oney wrote:
> Are 16|1 and 16+1 internally the same operation (for integers)?
For 16 and 1, the output of the two operations happen to be the same, but
generally a bitwise OR is not the same are addition. There are no carry bits
in the bitwis
On Thursday, May 17, 2018 at 4:54:11 AM UTC-7, Jpn Jha wrote:
> Dear Team
> Please attached Python_PyCharm Interpreter doc and zoom it .
>
> The screen shots are explanatory.
The Python mailing list is text-only. Your screen shots were removed.
In general, please don't use screenshots when as
On Wednesday, May 16, 2018 at 7:42:01 PM UTC-7, Abdur-Rahmaan Janhangeer wrote:
> why is x = list.remove(elem) not return the list?
>
> Abdur-Rahmaan Janhangeer
> https://github.com/Abdur-rahmaanJ
1) If you are naming your list "list," you're asking for trouble. Shadowing
builtin names is risky
On Monday, March 26, 2018 at 5:45:40 PM UTC-7, Chris Angelico wrote:
> On Tue, Mar 27, 2018 at 11:18 AM, wrote:
> > I have used multiprocessing before when I wrote some parallelized code.
> > That program required significant communication between processes, and it's
> > overkill for my purpos
Hi folks,
I've run into an odd situation. I have a custom USB peripheral device which
generates real-time data. I monitor this device using a PyQt5 app that I
wrote. Periodically I want to capture some of this data in files. Because of
a transient OS bug which apparently involves a corner c
On Wednesday, March 7, 2018 at 1:58:33 PM UTC-8, C W wrote:
> Hello,
>
> I am new to OOP.
There are (at least) two purposes for classes:
1) To group together data and functions in a meaningful way. Functions which
are defined inside a class are called methods.
2) To allow the preservation of
Python's standard library has (to take three examples) threads, processes, and
datetime functions. Meanwhile, PyQt has QThread, QProcess, and QDateTime.
Does this redundancy exist for C++ programmers who are programming Qt directly,
and who may lack a standard C++ library with these features?
On Tuesday, February 27, 2018 at 10:56:52 AM UTC-8, Grant Edwards wrote:
> If the student is actively trying to avoid learning something, there's
> nothing you can do to help them. They're just wasting their own time
> and money.
This is part of the reason why interviews for software developer jo
On Thursday, February 1, 2018 at 9:07:15 AM UTC-8, alister wrote:
> simple solution stop using google groups & use either the mailing list or
> a news server with an NNTP client
Sigh. I've been on Usenet since 1986. Is this how it ends? I will move if I
must.
Let me ask those of you who are
Please copy and paste the exact code you are running. The code you show has
several syntax errors, and would not execute at all.
Now, I think that I can read through your errors anyway, so let me ask you a
question: what is the largest possible value that can be represented with an
unsigned 8-
On Thursday, December 7, 2017 at 7:11:18 AM UTC-8, Rhodri James wrote:
> Sigh. Please don't do people's homework for them. It doesn't teach
> them anything. Now Nick had got 90% of the way there and shown his
> working, which is truly excellent, but what he needed was for someone to
> hint a
On Thursday, December 7, 2017 at 4:49:52 AM UTC-8, edmondo.g...@gmail.com wrote:
> import numpy
I teach Python to students at varying levels. As much as I love and use Numpy
in my regular work, I try to avoid showing beginning Python students solutions
that require third-party packages. Her
On Wednesday, November 8, 2017 at 10:51:35 PM UTC-8, r16...@rguktrkv.ac.in
wrote:
> How can I covert numbers into word like ex:-123 One hundred twenty three?
That's a classic homework exercise. Expect guidance, not an answer.
Why don't you solve a related, but simpler task first? This is a goo
On Thursday, September 21, 2017 at 9:29:19 AM UTC-7, Tobiah wrote:
> Are these completely equivalent?
>
> def foo(thing):
>
> assert(thing > 0), "Thing must be greater than zero"
>
>
> def foo(thing):
>
> if not (thing > 0): raise AssertionError("Thing must be greater than
> z
On Thursday, September 14, 2017 at 11:33:56 PM UTC-7, Ian wrote:
> On Fri, Sep 15, 2017 at 12:01 AM, wrote:
> > Hi,
> >
> > Can anyone help me in the below issue.
> >
> > I need to convert string to dictionary
> >
> > string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123',
> >
On Monday, August 14, 2017 at 4:41:23 PM UTC-7, Ho Yeung Lee wrote:
> my code can run without error,
>
> you can try to download one of face from search keyword "face"
> and try this script
You're assuming a lot. From your code:
from PIL import Image
# Two lines removed
import numpy
On Monday, August 14, 2017 at 12:30:21 PM UTC-7, Ho Yeung Lee wrote:
> https://gist.github.com/hoyeunglee/df7e6cb9b76c576b26fd2bb2b26bfe2f
>
> sample image
> https://drive.google.com/file/d/0Bxs_ao6uuBDUY09qM1JMWS1Ob0k/view?usp=sharing
>
> would like to rectangle bound the eye ,mouth corner etc
On Wednesday, July 26, 2017 at 8:06:19 AM UTC-7, Monica Snow wrote:
> Hi I am in need some understanding on how to become more knowledgeable while
> interviewing a candidate that requires Python and other (see below)
> experience...
I just want to jump in to say thank you, Ms. Snow, for making
On Monday, July 17, 2017 at 3:02:01 AM UTC-7, bream...@gmail.com wrote:
> On Monday, July 17, 2017 at 10:41:02 AM UTC+1, wxjm...@gmail.com wrote:
> > Poor Python.
> > Once it was working.
>
> Dear RUE,
>
> A bad workman always blames his tools.
>
> Mark Lawrence.
+1.
--
https://mail.python.or
On Thursday, June 22, 2017 at 2:57:02 PM UTC-7, Chris Angelico wrote:
> On Fri, Jun 23, 2017 at 7:21 AM, Marko Rauhamaa wrote:
> > I'm still wondering if those flurries of Italian calumnies are actually
> > steganographic instructions to intelligence agents of some country.
>
> It's a super-sneak
This is hilarious, I have to share:
https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
Thanks to Guido for making us all richer!
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, June 12, 2017 at 10:40:25 AM UTC-7, Forsaken uttax wrote:
> hello!!
>I was trying to install Tensorflow on my laptop with Gpu support
> so I Installed python the one in the screenshot below, and I put in pip
> Tensorflow Install command and it says syntax error so i try to u
On Saturday, May 20, 2017 at 9:13:39 AM UTC-7, qasi...@gmail.com wrote
> I have more than 100 ligand molecules. The image I showed at the beginning of
> this discussion was only an example. It had missing atoms.
> See it without missing any atom in the pdb format (coordinates in Angstrom
> unit)
On Friday, May 19, 2017 at 4:17:23 PM UTC-7, qasi...@gmail.com wrote:
> The center of mass of the whole ligand that I calculated is the center of
> geometry (the average/mean atomic positions) from the sample input file
> provided. I don't take other things into account, such as knowledge of the
On Thursday, May 18, 2017 at 2:44:54 PM UTC-7, qasi...@gmail.com wrote:
> Yes, I wrote: "The atoms of the first part/half according to the main COM of
> the ligand are C2, C7, C8 and C9. As for the second part they are C3, C4, C5
> and C6 atoms." It was just an example. In fact, I don't know whic
On Thursday, May 18, 2017 at 1:43:20 PM UTC-7, qasi...@gmail.com wrote:
> Dear Gregory Ewing,
>
> As I said before, I need to divide the molecule into two parts but don't know
> how to do it? It seems that I need to choose/determine a plane in 3D space
> which cuts the molecule in two parts. As
On Wednesday, May 17, 2017 at 12:14:10 AM UTC-7, Gregory Ewing wrote:
> I think the problem is ambiguous as stated. There are many planes
> you could pick through the centre of mass that divides the atoms
> into two groups. Some other rule is needed to decide which is the
> "right" one.
I took the
The last line of your function already calculates a center of mass for all
atoms.
How can you separate out that calculation into its own (one-line) function?
How can you send just a subset of your data to that new function?
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, May 14, 2017 at 12:53:41 PM UTC-7, bream...@gmail.com wrote:
> I report all of his posts on gg as hateful or violent content.
I have been doing the same. Google, are you listening?
--
https://mail.python.org/mailman/listinfo/python-list
On Friday, May 12, 2017 at 3:02:58 AM UTC-7, Steve D'Aprano wrote:
> (1) Table of functions/classes at the start of each module doc
>
> The docs for builtins starts with a table of built-in functions:
>
> https://docs.python.org/3/library/functions.html
>
>
> Docs for other modules should do s
On Monday, May 8, 2017 at 5:09:33 PM UTC-7, justin walters wrote:
> On Mon, May 8, 2017 at 3:40 PM, wrote:
>
> > Slide 15:
> >
> > > def sum(a, b, biteme=False):
> > > if biteme:
> > > shutil.rmtree('/')
> > > else:
> > > return a + b
> >
> > Now that's just evil. :^)
> >
Slide 15:
> def sum(a, b, biteme=False):
> if biteme:
> shutil.rmtree('/')
> else:
> return a + b
Now that's just evil. :^)
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, May 1, 2017 at 11:27:01 AM UTC-7, Robert L. wrote:
[no Python]
Do you ever plan to ask any questions about Python? Or are you just using a
few lines of code as a fig leaf for the race baiting that you post in your
signatures?
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, March 29, 2017 at 10:46:56 AM UTC-7, Michael Torrie wrote:
> On 03/29/2017 11:17 AM, j...@itu.edu wrote:
> > On Wednesday, March 29, 2017 at 1:23:48 AM UTC-7, arpitam...@gmail.com
> > wrote:
> >> Hi
> >> I am planning to tweak the Kernighan Lin algorithm a bit use coercing of
> >> c
On Wednesday, March 29, 2017 at 1:23:48 AM UTC-7, arpitam...@gmail.com wrote:
> Hi
> I am planning to tweak the Kernighan Lin algorithm a bit use coercing of
> certain vertices .I was wondering if u would be kind enough to share the
> python code with me so that i can include my idea in it.
Goo
On Tuesday, March 21, 2017 at 6:27:43 AM UTC-7, Zizwan wrote:
> Anyone can help me with this?
TensorFlow has a Python wrapper, but it isn't Python.
Do you require Python for what you are trying to do? You might try looking for
more information in the TensorFlow tutorial newsgroup:
https://gr
On Monday, March 20, 2017 at 10:05:33 AM UTC-7, Xristos Xristoou wrote:
> i have a little confused problem. i want to store some paths from images
> using python 2.7 in windows 10.
> i have some relative path like this var1='C:/my/store/path' and in the final
> folder where in my example is the n
On Sunday, March 19, 2017 at 1:11:45 PM UTC-7, Mikhail V wrote:
> Trying to line up things after a non-whitespace character, e.g. like this?
>
> myList = [
> ["a", "b", "c"],
> ["mess up your alignment", "b", "c"],
> ["a", "b", "c"]
On Thursday, March 16, 2017 at 7:07:17 PM UTC-7, Deborah Swanson wrote:
> Steve D'Aprano wrote,on March 16, 2017 5:07 AM
> >
> > On Thu, 16 Mar 2017 09:03 am, Gregory Ewing wrote:
> >
> > > Steve D'Aprano wrote:
> > >> You probably can't make a whale fly just by changing the class to
> > >> bird
On Thursday, March 16, 2017 at 9:27:56 PM UTC-7, Gregory Ewing wrote:
> Chris Angelico wrote:
> > Maybe what the ISS does isn't flying - it's falling with style?
>
> Yep. They didn't really launch it into orbit with rockets,
> that was all faked. They actually hauled it up there with
> a crane, le
> Does anyone know what I must change to get the full traceback?
Three years ago, I had a similar issue with incomplete tracebacks while using
multiprocessing.Pool. The discussion is here:
https://groups.google.com/forum/#!msg/comp.lang.python/qKTNNt8uKKU/biNyslh19ncJ;context-place=msg/comp.la
On Wednesday, February 15, 2017 at 2:52:55 AM UTC-8, Antoon Pardon wrote:
> Op 15-02-17 om 07:28 schreef Steven D'Aprano:
> > E.g. http://code.activestate.com/recipes/580750
> >
> > does nothing more that define
> >
> > echo = sys.stdout.write
> >
> > Why not use sys.stdout.write directly? Or prin
On Sunday, January 29, 2017 at 11:29:29 PM UTC-8, Irv Kalb wrote:
> It seems very odd that Python allows you to override the values of
> True and False.
Hi Irv,
Let me join the chorus of people who are encouraging you to switch to Python3,
which corrects this problem. Overriding builtins has
On Tuesday, January 31, 2017 at 12:34:38 PM UTC-8, MRAB wrote:
> On 2017-01-31 20:26, Larry Martell wrote:
> The module 'datetime' contains a class called 'datetime'. Judging by
> your exception, 'datetime' is the module.
>
> Try "datetime.datetime.strptime" instead.
This re-use of the name "da
On Monday, January 9, 2017 at 12:50:11 PM UTC-8, Joaquin Alzola wrote:
> >> elements. For example, if we have a list_a=["a","b","c","d"] and
> >> list_b=["a","b"] I want to obtain a new list_c containing elements that
> >> match between these lists (a and b here),
>
> >Perhaps this might work:
>
On Thursday, December 22, 2016 at 5:57:42 PM UTC-8, Chris Angelico wrote:
> On Fri, Dec 23, 2016 at 12:54 PM, wrote:
> > Wouldn't most users prefer that modern time zones be the default
> > information returned by pytz, instead of 150 year-old historical time zones?
>
> They're the *same* time
On Thursday, December 22, 2016 at 5:32:31 PM UTC-8, churros...@gmail.com wrote:
> Hello, I've been having troubles being able to integrate the PyQt5 GUI into
> my IDEs. I've used various example codes from the web to see if the library
> would import properly but the console sends me back an impo
On Thursday, December 22, 2016 at 3:47:04 PM UTC-8, Christian Heimes wrote:
> On 2016-12-22 21:49, Skip Montanaro wrote:
> > In a small application I realized I needed all my timestamps to have
> > timezone info. Some timestamp strings come in with no TZ markings, but
> > I know they are US/Eastern
On Wednesday, November 9, 2016 at 1:10:34 PM UTC-8, BartC wrote:
> On 09/11/2016 19:44, j...@i...edu wrote:
> Good point, I use Ubuntu under Windows. It should be child's play,
> except... 'sudo apt-get install numpy' or 'python-numpy' doesn't work.
>
> 'pip' doesn't work; it needs to be installe
On Wednesday, November 9, 2016 at 5:03:30 AM UTC-8, BartC wrote:
> On 05/11/2016 17:10, Mr. Wrobel wrote:
>
> > 1. What I have found is modified python interpreter - pypy -
> > http://pypy.org that does not require any different approach to develop
> > your code.
> >
> > 2. And: Gpu based computi
On Wednesday, November 9, 2016 at 4:32:15 AM UTC-8, Rustom Mody wrote:
> https://twitter.com/UdellGames/status/788690145822306304
It took me a minute to see it. That's insane!
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, November 5, 2016 at 6:39:52 PM UTC-7, Steve D'Aprano wrote:
> On Sun, 6 Nov 2016 09:17 am, Mr. Wrobel wrote:
>
>
> I don't have any experience with GPU processing. I expect that it will be
> useful for somethings, but for number-crushing and numeric work, I am
> concerned that GPUs r
On Thursday, November 3, 2016 at 3:47:41 PM UTC-7, jlad...@itu.edu wrote:
> On Thursday, November 3, 2016 at 1:09:48 PM UTC-7, Neil D. Cerutti wrote:
> > you may also be
> > able to use some items "off the shelf" from Python's difflib.
>
> I wasn't aware of that module, thanks for the tip!
>
> d
On Thursday, November 3, 2016 at 1:09:48 PM UTC-7, Neil D. Cerutti wrote:
> you may also be
> able to use some items "off the shelf" from Python's difflib.
I wasn't aware of that module, thanks for the tip!
difflib.SequenceMatcher.ratio() returns a numerical value which represents the
"similari
The Levenshtein distance is a very precise definition of dissimilarity between
sequences. It specifies the minimum number of single-element edits you would
need to change one sequence into another. You are right that it is fairly
expensive to compute.
But you asked for an algorithm that would
After reading this rather vague thread...
https://groups.google.com/forum/#!topic/comp.lang.python/FVnTe2i0UTY
... I find myself asking why Python doesn't include a standard, non-blocking
keyboard input function. I have often wanted one myself. The only way that
I've ever achieved this behavi
From: jlada...@itu.edu
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote:
> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote:
> > Killfile him and move on...
>
> But but but... I couldn't do that.
>
> https://www.xkcd.com/386/
I strongly suspected it would be that particu
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote:
> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote:
> > Killfile him and move on...
>
> But but but... I couldn't do that.
>
> https://www.xkcd.com/386/
I strongly suspected it would be that particular XKCD. :^)
--
http
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote:
> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote:
> > Killfile him and move on...
>
> But but but... I couldn't do that.
>
> https://www.xkcd.com/386/
I strongly suspected it would be that particular XKCD. :^)
--
htt
On Thursday, June 16, 2016 at 12:16:21 AM UTC-7, Vincent Vande Vyvre wrote:
> On Debian, this is a separate package python3-pyqt5.qtserialport, I
> don't know for other Linux
>
> After install you can use:
>
> from PyQt5.QtSeriaPort import QSerialPort
Thank you Vincent, that is exactly what I
On Thursday, June 16, 2016 at 12:16:21 AM UTC-7, Vincent Vande Vyvre wrote:
> On Debian, this is a separate package python3-pyqt5.qtserialport
Many thanks, Vincent, that was exactly what I needed!
--
https://mail.python.org/mailman/listinfo/python-list
I am developing a data acquisition system for a custom device that communicates
over USB. On the host computer side, I am using PyQt5.4. My Linux box has
both Qt4 and Qt5 installed on it. I assume that PyQt5.4 compiled on top of Qt5
automatically. I'm not sure how to check that.
In any case
On Tuesday, May 31, 2016 at 9:37:18 PM UTC-7, Gregory Ewing wrote:
> > So, how can I take the byte sequence <0x01 0x02 0x03 0x04 0x05 0x06 \n> that
> > Serial.readline() returns to me,
>
> Using readline() to read binary data doesn't sound like
> a good idea -- what happens if one of the data byte
On Tuesday, May 31, 2016 at 5:36:10 PM UTC-7, Michael Torrie wrote:
>
> I think you might want to use the struct module. It's designed for this
> kind of packing and unpacking:
>
> https://docs.python.org/3/library/struct.html
Hi Michael,
Thanks for pointing me at the struct module. There appe
On Tuesday, May 31, 2016 at 6:02:07 PM UTC-7, Rob Gaddi wrote:
> You'll probably want to process it in blocks. Allocate a 3kB
> bytearray, assign into it from the data coming in off Serial (less
> the newlines) and when you fill it, call numpy.from_buffer to rip it.
Thanks Rob, numpy.frombuffer
Greetings everyone,
I'm developing small embedded systems. I can't use Python to program them, I
have to program the little CPU's in C.
I want a peripheral I've designed to talk over USB to a Python program on the
host computer. The peripheral is spewing data at a reasonably high rate, abou
The best way to increase your motivation to learn Python is:
1. Select a non-trivial problem that you need to solve with programming.
2. Try to write the program you need in any other language (that you don't
already know well).
3. Write the program you need in Python.
4. Gaze in astonishment at
71 matches
Mail list logo