Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Numpy reshape
Post: Numpy reshape

I tried to reshape a 3-D matrix using two different ways. If the end result is 1-D the two methods match If the end result is 2-D the two method fails this code works a=np.random.randn(3,3,2) b1 = ...
mr_byte31 General Coding Help 1 1,078 Apr-22-2022, 02:10 PM
    Thread: execute commands inside a running application
Post: RE: execute commands inside a running application

(Apr-11-2022, 08:39 PM)Larz60+ Wrote: see: https://python-forum.io/thread-35651-pos...#pid150540Thx anyway. I already saw it before I wrote the thread. the post you send, connects the device via tty...
mr_byte31 General Coding Help 3 1,294 Apr-12-2022, 08:06 AM
    Thread: execute commands inside a running application
Post: execute commands inside a running application

I have an application that execute AT commands on certain device via USB. First I have to open Terminal, run the application via command line then start to execute AT commands. Output:> connectDe...
mr_byte31 General Coding Help 3 1,294 Apr-11-2022, 12:47 PM
    Thread: Process doesn't work but Thread work !
Post: RE: Process doesn't work but Thread work !

I got it. the code doesn't work on IDLE. I ran it from command line and it works !
mr_byte31 General Coding Help 4 2,555 Oct-18-2021, 06:29 PM
    Thread: Process doesn't work but Thread work !
Post: RE: Process doesn't work but Thread work !

(Oct-18-2021, 05:54 PM)buran Wrote: the second snippet works for me. I get Output:start sleeping 5 start sleeping 4 start sleeping 3 end sleeping 3 start sleeping 2 end sleeping 4 start sleep...
mr_byte31 General Coding Help 4 2,555 Oct-18-2021, 06:17 PM
    Thread: Process doesn't work but Thread work !
Post: Process doesn't work but Thread work !

I am just learning to work with multi threads/process. I wrote this code and it works well: import time import concurrent.futures numThreads = 3 def do_something(sec): print('start sleeping ',se...
mr_byte31 General Coding Help 4 2,555 Oct-18-2021, 05:25 PM
    Thread: Mult-threading and locking file
Post: RE: Mult-threading and locking file

(Oct-15-2021, 06:06 PM)Larz60+ Wrote: I wrote a tutorial on automatically creating a database from csv files. Note: Project uses sqlite database. Other DBMS can be used with a simple change to the m...
mr_byte31 General Coding Help 4 2,520 Oct-15-2021, 06:50 PM
    Thread: function that run once for all objects
Post: RE: function that run once for all objects

@deanhystad, this seem to work fine ! thanks
mr_byte31 General Coding Help 10 4,783 Oct-15-2021, 04:03 PM
    Thread: Mult-threading and locking file
Post: Mult-threading and locking file

I had a code which is running correctly but I feel it is not a professional code. I want your opinion to enhance it. Code : I create a lot of threads to web scrap some information that I am interest...
mr_byte31 General Coding Help 4 2,520 Oct-15-2021, 02:35 PM
    Thread: function that run once for all objects
Post: RE: function that run once for all objects

(Oct-14-2021, 03:22 PM)ndc85430 Wrote: You still haven't explained why you want to do this, or what's wrong with calling a method on the instance you want to use. It sounds like you've come up with ...
mr_byte31 General Coding Help 10 4,783 Oct-14-2021, 05:03 PM
    Thread: function that run once for all objects
Post: RE: function that run once for all objects

Thanks, I am aware about the __init__ method. I was thinking there is a specific magic method for this purpose.
mr_byte31 General Coding Help 10 4,783 Oct-14-2021, 01:02 PM
    Thread: Inheritance vs Instantiation for Python classes
Post: RE: Inheritance vs Instantiation for Python classe...

you explained it very well to me. thanks. I am coming from C language background and it is sometimes not easy to accept OOP concepts.
mr_byte31 General Coding Help 7 2,789 Oct-14-2021, 12:58 PM
    Thread: function that run once for all objects
Post: function that run once for all objects

I create a class and I added a code that download a file and parse it in the __init__ . for each object I create an object from my class it calls the init method. what I want is to automatically call...
mr_byte31 General Coding Help 10 4,783 Sep-30-2021, 07:15 PM
    Thread: Inheritance vs Instantiation for Python classes
Post: RE: Inheritance vs Instantiation for Python classe...

I didn't invent the examples. I just copied them I provided them to show the way they get written. someone can instantiate an object and get all functionality from methods and add his functionality a...
mr_byte31 General Coding Help 7 2,789 Sep-23-2021, 04:48 PM
    Thread: imaginary number i
Post: RE: imaginary number i

(Sep-23-2021, 03:59 PM)deanhystad Wrote: The reason -1**0.5 == -1 is that ** has higher precedence than unary -. The reason (-1)**5 ~= 1j is that the parenthesis change the order of operations. Un...
mr_byte31 General Coding Help 8 2,340 Sep-23-2021, 04:28 PM
    Thread: Inheritance vs Instantiation for Python classes
Post: RE: Inheritance vs Instantiation for Python classe...

I understand what you said some one can instantiate an object from a class and start to use its method to extend the functionality of other class. still inheritance was not needed !
mr_byte31 General Coding Help 7 2,789 Sep-23-2021, 04:21 PM
    Thread: imaginary number i
Post: RE: imaginary number i

then why the first one not correct?? >>> -1 ** 0.5 -1.0
mr_byte31 General Coding Help 8 2,340 Sep-23-2021, 04:01 PM
    Thread: Inheritance vs Instantiation for Python classes
Post: Inheritance vs Instantiation for Python classes

I know the meaning of Instantiation and Inheritance. I can inherit a class and use it methods and attributes. I also can instantiate a class and still can use the same methods and attributes !! I am ...
mr_byte31 General Coding Help 7 2,789 Sep-23-2021, 12:31 PM
    Thread: imaginary number i
Post: imaginary number i

I was trying the following commands : >>> -1 ** 0.5 -1.0 >>> (-1) ** 0.5 (6.123233995736766e-17+1j)I was expecting "1j" , "1i" or "i" I am just surprised to find different values...
mr_byte31 General Coding Help 8 2,340 Sep-23-2021, 12:08 PM
    Thread: multithreading issue with output
Post: RE: multithreading issue with output

just wrong post that was deleted
mr_byte31 General Coding Help 4 3,147 Sep-06-2019, 03:20 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020